Use custom version bumper

This commit is contained in:
Adriano Caloiaro 2024-01-18 08:55:51 -07:00
parent df030280c8
commit fc4d65a768
No known key found for this signature in database
GPG key ID: C2BC56DE73CE3F75
2 changed files with 18 additions and 39 deletions

View file

@ -13,16 +13,26 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Bump version and push tag
uses: anothrNick/github-tag-action@v1
- name: Setup go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- 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 git.sr.ht/~jcmuller/semver-bumper@latest
OLD_TAG=$(git tag --list 'v*' | semver-bumper -s)
NEW_TAG=$(git tag --list 'v*' | semver-bumper --increment minor)
sed -i "s/$OLD_TAG/$NEW_TAG/g" default.nix
git add default.nix
git commit -m "Bump version in default.nix" --allow-empty
git tag $NEW_TAG
git push
git push --tags
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:

View file

@ -1,31 +0,0 @@
name: Update default.nix with latest version
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT_TOKEN }} # Needs write access to the repo
ref: master
- name: Update default.nix
uses: MathieuSoysal/file-updater-for-release@v1.0.3
with:
files: default.nix # List of files to update
prefix: "version = \"" # Prefix before the version, default is: ""
with-checkout: false # If you don't want to checkout the repo, default is: true
- name: Push changes
uses: EndBug/add-and-commit@v9
with:
committer_name: GitHub Actions
committer_email: actions@github.com
add: default.nix
message: 'Update default.nix with latest version number'