diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index acd8e4f..f487429 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,17 @@ on: push: tags: - 'v*' + workflow_dispatch: + inputs: + tag: + description: 'Tag to release (e.g. v0.2.0)' + required: true + type: string + dry_run: + description: 'Skip publishing (dry run)' + required: false + type: boolean + default: true jobs: release: @@ -18,7 +29,7 @@ jobs: with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@41dfa10bef8ca8f7c4c7cec63b269ccb8a9156b9 # v6 + uses: actions/setup-go@v6 with: go-version-file: go.mod cache-dependency-path: go.sum @@ -30,11 +41,14 @@ jobs: 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" - name: Verify changie release notes exist run: | - if [ ! -f "changes/${{ github.ref_name }}.md" ]; then - echo "::error::Changie fragment changes/${{ github.ref_name }}.md not found." - echo "::error::Run 'changie batch ${{ github.ref_name }}' and 'changie merge' before pushing the tag." + if [ ! -f "changes/${{ steps.resolve_tag.outputs.tag }}.md" ]; then + echo "::error::Changie fragment changes/${{ steps.resolve_tag.outputs.tag }}.md not found." + echo "::error::Run 'changie batch ${{ steps.resolve_tag.outputs.tag }}' and 'changie merge' before pushing the tag." exit 1 fi - name: Execute GoReleaser @@ -42,11 +56,12 @@ jobs: with: distribution: goreleaser version: "~> v2" - args: release --clean --release-notes changes/${{ github.ref_name }}.md + args: release --clean --release-notes changes/${{ steps.resolve_tag.outputs.tag }}.md ${{ github.event.inputs.dry_run == 'true' && '--skip-publish' || '' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload assets - uses: actions/upload-artifact@5d5df5e032fcb57d3c9d9901e9b8f8b2b7d8051a # v7 + if: ${{ github.event.inputs.dry_run != 'true' }} + uses: actions/upload-artifact@v4 with: name: devcloud path: dist/*