di-tui/.github/workflows/goreleaser.yml
2024-10-10 09:02:27 -07:00

45 lines
1.3 KiB
YAML

name: goreleaser
on:
push:
branches:
- master
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
- name: Bump version and push tag
shell: bash
run: |
git config --global user.email "actions@github.com"
git config --global user.name "Github Actions"
go install github.com/caarlos0/svu@latest
OLD_TAG=$(svu current --strip-prefix)
NEW_TAG=$(svu next --strip-prefix)
[ "$OLD_TAG" == "$NEW_TAG" ] && echo "no version bump" && exit 0
sed -i "s/$OLD_TAG/$NEW_TAG/g" default.nix
sed -i "s/$OLD_TAG/$NEW_TAG/g" main.go
git add default.nix
git add main.go
git commit -m "bump di-tui version" --allow-empty
git tag v$NEW_TAG
git push
git push --tags
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}