✏️ 改用 gocq 同款 release

This commit is contained in:
fumiama 2021-10-15 15:57:42 +08:00
parent c183c4f17d
commit 1dbb4aa837
3 changed files with 115 additions and 82 deletions

View File

@ -2,54 +2,26 @@ name: 测试版
on: on:
push: push:
tags: tags:
- p* - 'p*'
env:
GITHUB_TOKEN: ${{ github.token }}
jobs: jobs:
my-job: goreleaser:
name: Build ZeroBot-Plugin on Push Tag 🚀
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.17 go-version: '1.17'
- name: Check out code into the Go module directory - name: Run GoReleaser
uses: actions/checkout@v2 uses: goreleaser/goreleaser-action@v2
- name: Cache Go
id: cache
uses: actions/cache@v2
with: with:
# A list of files, directories, and wildcard patterns to cache and restore version: latest
path: ~/go/pkg/mod args: release --rm-dist
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Tidy Go modules
run: go mod tidy
- name: Build linux-x64
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x64
- name: Build linux-x86
run: CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x86
- name: Build windows-x64
run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x64.exe
- name: Build windows-x86
run: CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x86.exe
- name: Build arm64
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-arm64
- name: Build armv6
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-armv6
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/zerobot-plugin-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true

View File

@ -2,54 +2,26 @@ name: 稳定版
on: on:
push: push:
tags: tags:
- v* - 'v*'
env:
GITHUB_TOKEN: ${{ github.token }}
jobs: jobs:
my-job: goreleaser:
name: Build ZeroBot-Plugin on Push Tag 🚀
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.17 go-version: '1.17'
- name: Check out code into the Go module directory - name: Run GoReleaser
uses: actions/checkout@v2 uses: goreleaser/goreleaser-action@v2
- name: Cache Go
id: cache
uses: actions/cache@v2
with: with:
# A list of files, directories, and wildcard patterns to cache and restore version: latest
path: ~/go/pkg/mod args: release --rm-dist
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Tidy Go modules
run: go mod tidy
- name: Build linux-x64
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x64
- name: Build linux-x86
run: CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-x86
- name: Build windows-x64
run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x64.exe
- name: Build windows-x86
run: CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-windows-x86.exe
- name: Build arm64
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-arm64
- name: Build armv6
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o artifacts/zerobot-plugin-linux-armv6
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/zerobot-plugin-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true

89
.goreleaser.yml Normal file
View File

@ -0,0 +1,89 @@
env:
- GO111MODULE=on
before:
hooks:
- go mod tidy
builds:
- id: nowin
env:
- CGO_ENABLED=0
- GO111MODULE=on
goos:
- linux
- darwin
goarch:
- 386
- amd64
- arm
- arm64
goarm:
- 6
- 7
ignore:
- goos: darwin
goarch: arm
- goos: darwin
goarch: 386
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- -s -w
- id: win
env:
- CGO_ENABLED=0
- GO111MODULE=on
goos:
- windows
goarch:
- 386
- amd64
- arm
- arm64
goarm:
- 7
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- -s -w
checksum:
name_template: "zbp_checksums.txt"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
- fix typo
- Merge pull request
- Merge branch
- Merge remote-tracking
- go mod tidy
archives:
- id: binary
builds:
- win
name_template: "zbp_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
format_overrides:
- goos: windows
format: binary
- id: nowin
builds:
- nowin
- win
name_template: "zbp_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
format_overrides:
- goos: windows
format: zip
nfpms:
- license: AGPL 3.0
homepage: https://go-cqhttp.org
file_name_template: "zbp_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
formats:
- deb
- rpm
maintainer: Kanri, DawnNights, Fumiama, Suika