From a3aed9ef933ea7194bf928dc91888c7e38080a17 Mon Sep 17 00:00:00 2001 From: Mateo Date: Thu, 22 Jan 2026 16:21:25 -0300 Subject: [PATCH] feat: auto-pin Docker image version in action.yml after release (#58) Add update-action-version job that automatically updates action.yml to reference the specific Docker image version after each release. This ensures users pinning the action version get the matching Docker image instead of :latest. --- .github/workflows/release.yaml | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e66f8a3..d066c6e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,7 +6,6 @@ on: paths-ignore: - '**.md' - '**/release.yaml' - - 'action.yml' branches: - main @@ -24,3 +23,34 @@ jobs: rolling-release-tag: "v1" semver-config: "config-release.yaml" secrets: inherit + + update-action-version: + needs: release + runs-on: ubuntu-latest + if: needs.release.outputs.version != '' + steps: + - uses: actions/checkout@v4 + with: + ref: main + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Update action.yml with release version + env: + VERSION: ${{ needs.release.outputs.version }} + run: | + echo "Updating action.yml to version: ${VERSION}" + sed -i "s|ghcr.io/lukaszraczylo/semver-generator:[^\"]*|ghcr.io/lukaszraczylo/semver-generator:${VERSION}|" action.yml + echo "Updated action.yml:" + grep "image:" action.yml + + - name: Commit and push + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add action.yml + if git diff --staged --quiet; then + echo "No changes to commit" + else + git commit -m "chore: pin action.yml Docker image to v${{ needs.release.outputs.version }}" + git push + fi