A Github Action that checks for Go upgrades and modifies the go.mod
file accordingly.
- uses: StefMa/Upgrade-Go-Action@{latestRelease or main}
with:
base-branch: 'master' # Defaults to 'main' if absent
gh-token: {{ secrets.GITHUB_TOKEN }} # Optional. But a custom token can be provided
It is like Dependabot or the Gradle Wrapper Upgrade Gradle Plugin. You shouldn't really care about the Go version as long as you don't build a Go library. You can always be on the bleeding edge 🙂
So, why not?
A fully working example can be seen below. It make sense to run this Action periodically to check for new Go versions.
name: Upgrade Go
on:
workflow_dispatch:
schedule:
- cron: "0 8 * * MON"
jobs:
upgrade-go:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: StefMa/Upgrade-Go-Action@main
with:
base-branch: 'master'
gh-token: ${{ secrets.CUSTOM_TOKEN }}
Full a full-reference, checkout the action.yml
file.
base-branch
The (base) branch where the PR will be created against at. Default is main.
gh-token
The gh-token that is used to create the pull request. Defaults to secrets.GITHUB_TOKEN
.
Please note that actions won't run with that token.
So a custom token might be desirable.
- Navigate to the Actions tab in your repository.
- Select the "Create Release" workflow.
- Click on "Run workflow" and enter the new version number (e.g.,
1.2.3
).
The new version tag will be created as well as the major tag will be created or updated. Also a draft GitHub release will be generated. You can view the releases on the Releases page.