Skip to content

Commit daae32c

Browse files
fix: release workflow syntax, add funding.yml
1 parent 089681c commit daae32c

2 files changed

Lines changed: 24 additions & 17 deletions

File tree

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [programmersd21]

.github/workflows/release.yml

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ on:
77
description: "Build a snapshot instead of publishing a release"
88
required: false
99
default: "false"
10+
type: boolean
1011
version:
11-
description: "Version to publish from VERSION"
12+
description: "Version to publish (must match VERSION file)"
1213
required: false
1314
default: ""
15+
type: string
1416

1517
permissions:
1618
contents: write
17-
packages: write
1819

1920
jobs:
2021
release:
@@ -24,50 +25,55 @@ jobs:
2425
- uses: actions/checkout@v4
2526
with:
2627
fetch-depth: 0
28+
2729
- uses: actions/setup-go@v5
2830
with:
2931
go-version-file: go.mod
3032
cache: true
33+
3134
- name: Load version
3235
shell: bash
3336
run: echo "VERSION=$(tr -d '\r\n' < VERSION)" >> "$GITHUB_ENV"
37+
3438
- name: Verify version override
39+
if: inputs.version != ''
3540
shell: bash
3641
run: |
37-
if [ -n "${{ inputs.version }}" ] && [ "${{ inputs.version }}" != "$VERSION" ]; then
38-
echo "VERSION file does not match the requested release version." >&2
42+
if [ "${{ inputs.version }}" != "$VERSION" ]; then
43+
echo "::error::Input version ${{ inputs.version }} does not match VERSION file ($VERSION)" >&2
3944
exit 1
4045
fi
46+
4147
- name: Create release tag
42-
if: ${{ inputs.snapshot != 'true' }}
48+
if: inputs.snapshot == false
4349
shell: bash
4450
run: |
4551
git config user.name "github-actions[bot]"
4652
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
4753
TAG="v${VERSION}"
4854
if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null; then
49-
echo "Tag ${TAG} already exists." >&2
50-
exit 1
55+
echo "::warning::Tag ${TAG} already exists, skipping tag creation."
56+
else
57+
git tag -a "${TAG}" -m "Release ${TAG}"
58+
git push origin "${TAG}"
5159
fi
52-
git tag -a "${TAG}" -m "Release ${TAG}"
53-
git push origin "${TAG}"
54-
- name: Run GoReleaser snapshot
55-
if: ${{ inputs.snapshot == 'true' }}
60+
61+
- name: Run GoReleaser (snapshot)
62+
if: inputs.snapshot == true
5663
uses: goreleaser/goreleaser-action@v6
5764
with:
5865
distribution: goreleaser
59-
version: latest
66+
version: "~> v2"
6067
args: release --snapshot --clean
6168
env:
62-
VERSION: ${{ env.VERSION }}
6369
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64-
- name: Run GoReleaser release
65-
if: ${{ inputs.snapshot != 'true' }}
70+
71+
- name: Run GoReleaser (release)
72+
if: inputs.snapshot == false
6673
uses: goreleaser/goreleaser-action@v6
6774
with:
6875
distribution: goreleaser
69-
version: latest
76+
version: "~> v2"
7077
args: release --clean
7178
env:
72-
VERSION: ${{ env.VERSION }}
7379
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)