From a6709a1307c5094df7a88fe461cdfb90946c6efd Mon Sep 17 00:00:00 2001 From: Gunwant Jain Date: Thu, 20 Jan 2022 05:21:25 +0530 Subject: [PATCH] buildci: generalise for all push events and PRs This means that tags are included now Signed-off-by: Gunwant Jain --- .github/buildci.sh | 4 ++-- .github/workflows/buildci.yml | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/buildci.sh b/.github/buildci.sh index e67a4f8..7af1a33 100644 --- a/.github/buildci.sh +++ b/.github/buildci.sh @@ -16,7 +16,7 @@ setup_cross_compiling() { # Building for the given architecture build_for_arch() { __ARCH=$1 - __SHA=$2 + __REF=$2 # Statically compile case "$__ARCH" in \ @@ -29,5 +29,5 @@ build_for_arch() { # Export them artifacts mkdir -p artifacts - cp -av /home/runner/.cargo/bin/bin "artifacts/bin-$__SHA-$__TARGET" + cp -av /home/runner/.cargo/bin/bin "artifacts/bin-$__REF-$__TARGET" } \ No newline at end of file diff --git a/.github/workflows/buildci.yml b/.github/workflows/buildci.yml index a39a04f..5b9a43f 100644 --- a/.github/workflows/buildci.yml +++ b/.github/workflows/buildci.yml @@ -1,12 +1,6 @@ name: Build CI -on: - push: - branches: - - "*" - pull_request: - branches: - - master +on: [push, pull_request] jobs: build: @@ -31,8 +25,12 @@ jobs: - name: Build run: | + [ $GITHUB_REF_TYPE = "branch" ] && \ + export __REF=${GITHUB_SHA::7} || \ + export __REF=$GITHUB_REF_NAME + source ./.github/buildci.sh - build_for_arch ${{ matrix.arch }} ${GITHUB_SHA::7} + build_for_arch ${{ matrix.arch }} $__REF - name: Export artifacts uses: actions/upload-artifact@v2