Use latest go releaser #144
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
pull_request: | |
push: | |
permissions: | |
contents: write | |
jobs: | |
releaser: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- | |
name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.17 | |
- name: Set AUTOUPDATE_CHANNEL on tags | |
run: echo "AUTOUPDATE_CHANNEL=stable" >> $GITHUB_ENV | |
if: startsWith(github.ref, 'refs/tags/v') | |
- | |
name: Prepare | |
run: go generate ./ | |
- | |
name: Check Git status | |
id: git | |
run: | | |
RESULT=$(git status --untracked-files=no --porcelain) | |
echo "gitstatus=$RESULT" >> $GITHUB_OUTPUT | |
- | |
name: Check if go prepare updated generated Go code | |
if: steps.git.outputs.gitstatus != '' | |
run: | | |
echo '"go generate" changed some Go generated code, run "go generate ./" locally and make a Pull Request with the changes' | |
git diff | |
exit 1 | |
- | |
name: Test | |
run: go test -v ./... | |
- | |
name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
version: '~> v2' | |
args: release --clean --snapshot --skip=publish,sign | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PAT }} | |
- | |
name: Archive binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
retention-days: 5 | |
path: dist |