更新action编排,自动替换版本号 #11
Workflow file for this run
This file contains 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: go-releaser | |
permissions: | |
contents: write | |
id-token: write | |
packages: write | |
on: | |
push: | |
tags: [ 'v*' ] | |
jobs: | |
goreleaser: | |
runs-on: ubuntu-latest | |
env: | |
flags: '' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21 | |
cache: true | |
- name: Replace version in version.go | |
run: | | |
tag=$(echo $GITHUB_REF | sed 's/refs\/tags\///') | |
sed -i "s/const RuntimeVersion = \".*\"/const RuntimeVersion = \"$tag\"/" app/version.go | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --clean ${{ env.flags }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |