Skip to content

Commit

Permalink
✏️ 改用 gocq 同款 release
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Oct 15, 2021
1 parent c183c4f commit 1dbb4aa
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 82 deletions.
54 changes: 13 additions & 41 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,26 @@ name: 测试版
on:
push:
tags:
- p*

env:
GITHUB_TOKEN: ${{ github.token }}
- 'p*'

jobs:
my-job:
name: Build ZeroBot-Plugin on Push Tag 🚀
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Cache Go
id: cache
uses: actions/cache@v2
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}

- 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
go-version: '1.17'

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/zerobot-plugin-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54 changes: 13 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,26 @@ name: 稳定版
on:
push:
tags:
- v*

env:
GITHUB_TOKEN: ${{ github.token }}
- 'v*'

jobs:
my-job:
name: Build ZeroBot-Plugin on Push Tag 🚀
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Cache Go
id: cache
uses: actions/cache@v2
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}

- 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
go-version: '1.17'

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/zerobot-plugin-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89 changes: 89 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1dbb4aa

Please sign in to comment.