feat: add GitHub action

This commit is contained in:
wux1an
2023-05-22 22:53:53 +08:00
parent f84c29a0ca
commit 8a73bf468c
2 changed files with 85 additions and 0 deletions

34
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: 🎉 Release Binary
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Install upx
run: sudo apt install upx -y
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

51
.goreleaser.yml Normal file
View File

@@ -0,0 +1,51 @@
before:
hooks:
- go mod tidy
builds:
- main: .
env:
- CGO_ENABLED=0
goos:
- windows
goarch:
- amd64
ignore:
- goos: windows
goarch: 'arm64'
binary: 'wxapkg'
flags:
- '-trimpath'
ldflags:
- '-s -w'
- '-X main.version={{ .Version }}'
- '-X main.commit={{ .ShortCommit }}'
hooks:
post: "upx --lzma {{ .Path }}"
changelog:
filters:
exclude:
- '^doc:'
- typo
- (?i)foo
- '^ref'
- '^style'
groups:
- title: Features
regexp: "^.*feat[(\\w)]*:+.*$"
order: 0
- title: 'Bug fixes'
regexp: "^.*fix[(\\w)]*:+.*$"
order: 1
- title: Others
order: 999
archives:
- format: binary
checksum:
algorithm: md5