Skip to content

Commit

Permalink
添加actions 自动打包
Browse files Browse the repository at this point in the history
  • Loading branch information
hopetree committed Apr 2, 2024
1 parent cc4bd05 commit 990a58e
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 1 deletion.
32 changes: 32 additions & 0 deletions .github/workflows/go-releaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: go-releaser

permissions:
contents: write
id-token: write
packages: write

on:
push:
tags: [ 'v*' ]

jobs:
goreleaser:
runs-on: ubuntu-latest
env:
flags: ''
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21
cache: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean ${{ env.flags }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54 changes: 54 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
project_name: GoMonitor

before:
hooks:
- go mod tidy

builds:
- binary: GoMonitor
main: .
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- '386'
- amd64
- arm
- arm64
goarm:
- '6'
- '7'
ignore:
- goos: linux
goarch: arm
goarm: '7'

checksum:
name_template: "checksums.txt"

archives:
- name_template: >-
{{ .ProjectName }}_
{{- .Version }}_
{{- if eq .Os "darwin" }}macos_
{{- else }}{{ .Os }}_{{ end }}
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else if eq .Arch "arm64" }}aarch64
{{- else if eq .Arch "arm" }}armv{{ .Arm }}
{{- else }}{{ .Arch }}{{ end }}
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip
builds_info:
group: root
owner: root
files:
- README.md
- LICENSE
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

```shell
go mod tidy
bo build
go build
```

## 命令使用
Expand Down

0 comments on commit 990a58e

Please sign in to comment.