From 49b7b18fde16b02fa2eb3a2d2de07707da050d00 Mon Sep 17 00:00:00 2001 From: EngiGu Date: Mon, 1 Jan 2024 19:10:22 +0800 Subject: [PATCH] Update release.yml --- .github/workflows/release.yml | 49 ++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ea4d632..dd19c16 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,27 +1,40 @@ -name: build +name: goreleaser on: - release: - types: [created] # 表示在创建新的 Release 时触发 + push: + # run only against tags + tags: + - '*' + +permissions: + contents: write + # packages: write + # issues: write jobs: - build-go-binary: + goreleaser: runs-on: ubuntu-latest - strategy: - matrix: - goos: [linux, windows, darwin] # 需要打包的系统 - goarch: [amd64, arm64] # 需要打包的架构 - exclude: # 排除某些平台和架构 - - goarch: arm64 - goos: windows steps: - uses: actions/checkout@v3 - - uses: wangyoucao577/go-release-action@v1.30 with: - github_token: ${{ secrets.REPO_GITHUB_TOKEN }} # 一个默认的变量,用来实现往 Release 中添加文件 - goos: ${{ matrix.goos }} - goarch: ${{ matrix.goarch }} - goversion: 1.20.1 # 可以指定编译使用的 Golang 版本 - binary_name: "message-nest" # 可以指定二进制文件的名称 - extra_files: LICENSE README.md # 需要包含的额外文件 + fetch-depth: 0 + - run: git fetch --force --tags + - uses: actions/setup-go@v3 + with: + go-version: '>=1.20.2' + cache: true + # More assembly might be required: Docker logins, GPG, etc. It all depends + # on your needs. + - uses: goreleaser/goreleaser-action@v4 + with: + # either 'goreleaser' (default) or 'goreleaser-pro': + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Your GoReleaser Pro key, if you are using the 'goreleaser-pro' + # distribution: + # GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} +