From 1fc72ef0f32c4394b147644846db9d4abf688d80 Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Fri, 26 Apr 2024 18:10:04 +0000 Subject: [PATCH] feat: sepate tag/master builds --- .github/workflows/beats.yml | 11 +++++++---- build.sh | 9 ++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/beats.yml b/.github/workflows/beats.yml index 9641cea..1ba0aa8 100644 --- a/.github/workflows/beats.yml +++ b/.github/workflows/beats.yml @@ -31,12 +31,15 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set tag - run: echo "git_tag=:${GITHUB_REF#refs/*/}" >> $GITHUB_STATE + - name: Build beat (tag) + id: build-beat + if: "startsWith(github.ref, 'refs/tags/')" + run: ./build.sh ${{ matrix.beat }} ${{ matrix.arch }} - - name: Build beat + - name: Build beat (master) id: build-beat - run: ./build.sh ${{ matrix.beat }} ${{ matrix.arch }} $git_tag + if: "!startsWith(github.ref, 'refs/tags/')" + run: ./build.sh ${{ matrix.beat }} ${{ matrix.arch }} master - uses: actions/upload-artifact@v2 if: startsWith(github.ref, 'refs/tags/') diff --git a/build.sh b/build.sh index 5930f32..466aee8 100755 --- a/build.sh +++ b/build.sh @@ -3,11 +3,14 @@ #set -e BEAT="${1:-filebeat}" ARCH="${2:-armv7l}" -BRANCH="${3}" +REF_NAME="${3}" -TAG=$(git describe --tags --exact-match 2> /dev/null) +if [[ -n ${GITHUB_REF_NAME} ]] ; then + BRANCH=${GITHUB_REF_NAME} + echo "Using GITHUB_REF_NAME(${BRANCH})" +fi -if [[ -z ${TAG} ]] ; then +if [[ -z ${BRANCH} ]] ; then BRANCH="master" echo "Using default branch(${BRANCH})" fi