From 1cd01669cb319ad2ba629861f920c2a30a4ca4cd Mon Sep 17 00:00:00 2001 From: Marty Pitt Date: Mon, 14 Sep 2026 18:24:08 +0100 Subject: [PATCH] ci: build and publish on release tags, skip the duplicate branch run The push trigger only listed branches, so a pushed release tag never started a run: the tag-aware steps (versioned docker image, :latest) had never executed, and 1.0.0 had to be published by hand via workflow_dispatch. Add the tag trigger. tag-release.sh pushes the release commit to main before the tag, which would now build and deploy the same release twice. A gate job skips branch runs whose pom carries a non-SNAPSHOT version; the tag run publishes those. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_013JvovM6T4az5f5qy3rpTVg --- .github/workflows/build.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 49c5e82..88376d3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,13 +3,38 @@ name: Build on: push: branches: [ "main" ] + # Release tags, as created by tag-release.sh. The tag run deploys the release + # jars and publishes the versioned docker image (see determine-version). + tags: [ '[0-9]+.[0-9]+.[0-9]+*' ] pull_request: branches: [ "main" ] # Manual runs: on main this publishes orbitalhq/nebula:next, same as a push build workflow_dispatch: jobs: + # tag-release.sh pushes the release commit to main and then pushes the tag, which + # would build and deploy the same release twice. A branch run whose pom carries a + # release (non-SNAPSHOT) version is skipped here and left to the tag run. + gate: + runs-on: ubuntu-latest + outputs: + build: ${{ steps.decide.outputs.build }} + steps: + - uses: actions/checkout@v4 + - name: Decide whether this run should build + id: decide + run: | + version=$(sed -n 's:.*\(.*\).*:\1:p' pom.xml | head -1) + if [ "${{ github.ref_type }}" != "tag" ] && [[ "$version" != *-SNAPSHOT ]]; then + echo "Release version ${version} on a branch run: skipping, the tag run publishes it" + echo "build=false" >> "$GITHUB_OUTPUT" + else + echo "build=true" >> "$GITHUB_OUTPUT" + fi + build-jvm: + needs: gate + if: needs.gate.outputs.build == 'true' runs-on: ubuntu-latest steps: