From 29bc5a5054af52b7eeda324bdd15db80ce8a2611 Mon Sep 17 00:00:00 2001 From: Sung-Kyu Yoo Date: Tue, 21 Apr 2026 02:14:03 +0900 Subject: [PATCH 1/2] fix: use --snapshot flag for GoReleaser dry-run mode When running via workflow_dispatch in dry-run mode, GoReleaser failed because the tag does not exist on the commit. Use --snapshot to skip git state validation and build without publishing. Also skip Docker setup/login steps during dry-run. --- .github/workflows/release.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f487429..138a886 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,14 +33,6 @@ jobs: with: go-version-file: go.mod cache-dependency-path: go.sum - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4 - - name: Login to GitHub Container Registry - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - name: Resolve tag id: resolve_tag run: echo "tag=${{ github.event.inputs.tag || github.ref_name }}" >> "$GITHUB_OUTPUT" @@ -51,12 +43,25 @@ jobs: echo "::error::Run 'changie batch ${{ steps.resolve_tag.outputs.tag }}' and 'changie merge' before pushing the tag." exit 1 fi + - name: Set up Docker Buildx + if: ${{ github.event.inputs.dry_run != 'true' }} + uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4 + - name: Login to GitHub Container Registry + if: ${{ github.event.inputs.dry_run != 'true' }} + uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Execute GoReleaser uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # goreleaser-action v7 with: distribution: goreleaser version: "~> v2" - args: release --clean --release-notes changes/${{ steps.resolve_tag.outputs.tag }}.md ${{ github.event.inputs.dry_run == 'true' && '--skip-publish' || '' }} + args: >- + ${{ github.event.inputs.dry_run == 'true' + && format('release --clean --snapshot --release-notes changes/{0}.md', steps.resolve_tag.outputs.tag) + || format('release --clean --release-notes changes/{0}.md', steps.resolve_tag.outputs.tag) }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload assets From b2d149ff935f6c4434d6c510b0ced41adb42ae86 Mon Sep 17 00:00:00 2001 From: Sung-Kyu Yoo Date: Tue, 21 Apr 2026 02:17:40 +0900 Subject: [PATCH 2/2] refactor: simplify GoReleaser args by computing snapshot flag in resolve step Move --snapshot flag computation into the resolve_tag step output to eliminate duplicated args in the ternary expression. --- .github/workflows/release.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 138a886..0f38c4b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,7 +35,11 @@ jobs: cache-dependency-path: go.sum - name: Resolve tag id: resolve_tag - run: echo "tag=${{ github.event.inputs.tag || github.ref_name }}" >> "$GITHUB_OUTPUT" + run: | + echo "tag=${{ github.event.inputs.tag || github.ref_name }}" >> "$GITHUB_OUTPUT" + if [[ "${{ github.event.inputs.dry_run }}" == "true" ]]; then + echo "extra_flags=--snapshot" >> "$GITHUB_OUTPUT" + fi - name: Verify changie release notes exist run: | if [ ! -f "changes/${{ steps.resolve_tag.outputs.tag }}.md" ]; then @@ -58,10 +62,7 @@ jobs: with: distribution: goreleaser version: "~> v2" - args: >- - ${{ github.event.inputs.dry_run == 'true' - && format('release --clean --snapshot --release-notes changes/{0}.md', steps.resolve_tag.outputs.tag) - || format('release --clean --release-notes changes/{0}.md', steps.resolve_tag.outputs.tag) }} + args: release --clean ${{ steps.resolve_tag.outputs.extra_flags }} --release-notes changes/${{ steps.resolve_tag.outputs.tag }}.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload assets