Skip to content

Commit

Permalink
ci: add releaser
Browse files Browse the repository at this point in the history
  • Loading branch information
mcoo committed Apr 30, 2023
1 parent 8dd8e0a commit 97adb17
Show file tree
Hide file tree
Showing 11 changed files with 593 additions and 67 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: release

on:
push:
branches:
- 'master'
- 'beta'
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version (No "v")'
required: true
type: string
pull_request:
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
-
name: Tests
run: |
go mod tidy
go test -v ./...
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: "v1.17.2"
args: release --rm-dist --skip-validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.exe
go.sum
*.log
.idea
*.opq
dist
config.yaml
89 changes: 89 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
before:
hooks:
- go mod tidy
builds:
- id: "Yui"
main: ./
env:
- CGO_ENABLED=0
goarm:
- 6
- 7
goarch:
- amd64
- arm
- arm64
- 386
goos:
- linux
- windows
- darwin
ignore:
- goos: android
goarch: arm
- goos: darwin
goarch: 386
- goos: darwin
goarch: arm
- goos: windows
goarch: arm
- goos: windows
goarch: arm64
- goos: android
goarch: 386
- id: "Yui-cli"
binary: "Yui-cli"
main: ./plugin/builder
env:
- CGO_ENABLED=0
goarm:
- 6
- 7
goarch:
- amd64
- arm
- arm64
- 386
goos:
- linux
- windows
- darwin
ignore:
- goos: android
goarch: arm
- goos: darwin
goarch: 386
- goos: darwin
goarch: arm
- goos: windows
goarch: arm
- goos: windows
goarch: arm64
- goos: android
goarch: 386
archives:
-
name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
format_overrides:
- goos: windows
format: zip
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
files:
- config.yaml.example
- LICENSE
release:
prerelease: auto
checksum:
name_template: 'checksums.txt'
project_name: Yui
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
7 changes: 7 additions & 0 deletions config.yaml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
httpproxy: http://127.0.0.1:7890 # 插件 HTTP 服务时会使用的 Proxy
opqurl: http://127.0.0.1:8086 # OPQ 的地址
admin:
- 0 # 管理员
plugin:
env:
test: opqbot # 环境变量 将会传递到插件内
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ go 1.19
require (
github.com/charmbracelet/log v0.2.1
github.com/ethereum/go-ethereum v1.11.6
github.com/fogleman/gg v1.3.0
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
github.com/google/uuid v1.3.0
github.com/imroc/req/v3 v3.33.2
github.com/knqyf263/go-plugin v0.7.1-0.20230420183704-82cf9090ca1e
Expand All @@ -20,7 +18,6 @@ require (
github.com/spf13/viper v1.15.0
github.com/tetratelabs/wazero v1.0.3
github.com/tidwall/gjson v1.14.4
golang.org/x/image v0.0.0-20190802002840-cff245a6509b
golang.org/x/tools v0.8.0
google.golang.org/protobuf v1.30.0
)
Expand Down Expand Up @@ -63,6 +60,7 @@ require (
github.com/quic-go/quic-go v0.32.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rotisserie/eris v0.5.4 // indirect
github.com/shoenig/go-m1cpu v0.1.4 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand Down
128 changes: 64 additions & 64 deletions plugin/meta/meta_generate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 97adb17

Please sign in to comment.