From 2be985aa9839daee45cc14653acf0a01d3233b20 Mon Sep 17 00:00:00 2001 From: lufreita Date: Wed, 9 Sep 2026 18:30:56 -0300 Subject: [PATCH] ROSAENG-66693 | ci: auto-bump DefaultVersion on master after release Add a GitHub Actions workflow triggered on published (non-prerelease) GitHub releases that opens a signed PR to update the DefaultVersion fallback in pkg/info/info.go. This removes the manual version-bump step from the release checklist. Combined with the ldflags injection from ROSAENG-66692, the CLI version is fully derived from the git tag at build time, with master keeping a current fallback for local/dev builds. Signed-off-by: Lucas Freitas Signed-off-by: lufreita --- .github/workflows/bump-version.yml | 69 ++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/bump-version.yml diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml new file mode 100644 index 0000000000..7ce0bd0a8c --- /dev/null +++ b/.github/workflows/bump-version.yml @@ -0,0 +1,69 @@ +name: Bump DefaultVersion + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + bump-version: + concurrency: + group: bump-default-version + cancel-in-progress: true + if: "!github.event.release.prerelease" + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Checkout master + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: master + + - name: Derive and validate release version + id: version + env: + RAW_TAG: ${{ github.event.release.tag_name }} + run: | + set -euo pipefail + VERSION="${RAW_TAG#v}" + if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "::error::Tag '${RAW_TAG}' is not a stable semver release" + exit 1 + fi + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "Bumping DefaultVersion to $VERSION" + + - name: Update pkg/info/info.go + env: + NEW_VERSION: ${{ steps.version.outputs.version }} + run: | + sed -i "s/^var DefaultVersion = \".*\"/var DefaultVersion = \"${NEW_VERSION}\"/" pkg/info/info.go + grep 'DefaultVersion' pkg/info/info.go + + - name: Create PR + uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: bump-default-version + base: master + title: "OCM-00000 | chore: bump DefaultVersion to ${{ steps.version.outputs.version }}" + body: | + ## DefaultVersion bump + + Auto-update `DefaultVersion` in `pkg/info/info.go` to `${{ steps.version.outputs.version }}` + after release `${{ github.event.release.tag_name }}`. + + This keeps the fallback value on master current for local and + non-tagged builds. + + Auto-generated by GitHub Actions. + commit-message: "OCM-00000 | chore: bump DefaultVersion to ${{ steps.version.outputs.version }}" + labels: chore + delete-branch: true + add-paths: "pkg/info/info.go" + sign-commits: true + signoff: true