新建一个 Token: https://github.com/settings/tokens/new
创建一个项目,新建 Secrets 把上面的 token 复制进去
在根目录创建 .goreleaser.yml
before:hooks:- go mod tidybuilds:- env: [CGO_ENABLED=0]goos:- linux- windows- darwingoarch:- amd64- 386- arm- arm64ignore:- goos: darwingoarch: '386'- goos: windowsgoarch: 'arm'- goos: windowsgoarch: 'arm64'dir: .main: .archives:- format: zipreplacements:darwin: macOSchecksum:algorithm: sha256
新建两个目录一个文件:.github/workflows/go.yml
name: Goon:create:tags:- v*workflow_dispatch:jobs:release:runs-on: ubuntu-lateststeps:- name: "Check out code"uses: actions/checkout@v3with:fetch-depth: 0- name: "Set up Go"uses: actions/setup-go@v2with:go-version: 1.17- name: "Create release on GitHub"uses: goreleaser/goreleaser-action@v2with:args: "release --rm-dist"version: latestworkdir: .env:GITHUB_TOKEN: "${{ secrets.TEST }}"

具体测试项目结构,然后 push 上去
新建一个 tags
查看 Actions ,没报错
此时再查看 Releases 就已经打包好 go 程序了
参考:
https://github.com/SummerSec/SpringExploit/blob/main/.github/workflows/release-binary.yml
https://github.com/SummerSec/template/blob/main/.goreleaser.yml
