Skip to content

Commit

Permalink
fix(ci): handle release builds in GHA CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
BradLugo committed Jul 8, 2024
1 parent 372710a commit 1bb249e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/actions/handle-tagged-build/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Handle tagged build
description: Handle tagged build
runs:
using: composite
steps:
- name: Handle tagged build
run: |
source ./scripts/ci/lib.sh
handle_gha_tagged_build
shell: bash
6 changes: 6 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ jobs:
- name: Cache Go dependencies
uses: ./.github/actions/cache-go-dependencies

- uses: ./.github/actions/handle-tagged-build

- name: Build updater (amd64)
run: make build-updater

Expand Down Expand Up @@ -83,6 +85,8 @@ jobs:
- name: Cache Go dependencies
uses: ./.github/actions/cache-go-dependencies

- uses: ./.github/actions/handle-tagged-build

- name: Build Scanner
run: make GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} scanner-build-nodeps

Expand Down Expand Up @@ -371,6 +375,8 @@ jobs:

- uses: ./.github/actions/job-preamble

- uses: ./.github/actions/handle-tagged-build

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

Expand Down
15 changes: 15 additions & 0 deletions scripts/ci/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,21 @@ handle_release_runs() {
fi
}

handle_gha_tagged_build() {
if [[ -z "${GITHUB_REF:-}" ]]; then
echo "No GITHUB_REF in env"
exit 0
fi
echo "GITHUB_REF: ${GITHUB_REF}"
if [[ "${GITHUB_REF:-}" =~ ^refs/tags/ ]]; then
tag="${GITHUB_REF#refs/tags/*}"
echo "This is a tagged build: $tag"
echo "RELEASE_TAG=$tag" >> "$GITHUB_ENV"
else
echo "This is not a tagged build"
fi
}

store_test_results() {
if [[ "$#" -ne 2 ]]; then
die "missing args. usage: store_test_results <from> <to>"
Expand Down

0 comments on commit 1bb249e

Please sign in to comment.