aa #21
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: goreleaser | |
on: | |
push: | |
tags: | |
- "*" # 打标签时构建 | |
permissions: | |
contents: write | |
jobs: | |
release-linux-binary: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install cross-compiler for linux/arm64 | |
run: sudo apt-get install -y gcc-aarch64-linux-gnu | |
- name: Set up git tag | |
uses: devops-actions/[email protected] | |
with: | |
strip_v: false | |
- name: Replace __VERSION__ in cmds/root.go | |
run: sed -i "s/__VERSION__/${{ steps.get_tag.outputs.tag }}/" cmds/root.go && cat cmds/root.go | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --skip=validate --config .github/workflows/.goreleaser-for-linux.yml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GO_BUILD_TOKEN}} | |
- name: Upload assets | |
uses: actions/upload-artifact@v3 | |
with: | |
name: myapp | |
path: dist/* | |
release-darwin-binary: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.23.1 # 指定 Go 版本 | |
- name: Set up git tag | |
uses: devops-actions/[email protected] | |
with: | |
strip_v: false | |
- name: Replace __VERSION__ in cmds/root.go | |
run: sed -i '' "s/__VERSION__/${{ steps.get_tag.outputs.tag }}/" cmds/root.go | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
# either 'goreleaser' (default) or 'goreleaser-pro' | |
distribution: goreleaser | |
version: latest | |
args: release --skip=validate --config .github/workflows/.goreleaser-for-darwin.yml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GO_BUILD_TOKEN}} | |
- name: Upload assets | |
uses: actions/upload-artifact@v3 | |
with: | |
name: myapp | |
path: dist/* | |