Skip to content

Commit 94ca35a

Browse files
committed
ci: add release ci
1 parent 203f0e1 commit 94ca35a

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

.github/workflows/release.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
# run only against tags
6+
tags:
7+
- '*'
8+
9+
permissions:
10+
contents: write
11+
# packages: write
12+
# issues: write
13+
14+
jobs:
15+
goreleaser:
16+
runs-on: ubuntu-latest
17+
env:
18+
# 声明哪些是私仓
19+
GOPRIVATE: github.com/scagogogo/*
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
- run: git config --global url.https://${{ secrets.GH_CLASS_VERSION_TRACKER_TOKEN }}@github.com/.insteadOf https://github.com/
25+
- run: git fetch --force --tags
26+
- uses: actions/setup-go@v3
27+
with:
28+
go-version: '>=1.19.2'
29+
cache: true
30+
# More assembly might be required: Docker logins, GPG, etc. It all depends
31+
# on your needs.
32+
- uses: goreleaser/goreleaser-action@v2
33+
with:
34+
# either 'goreleaser' (default) or 'goreleaser-pro'
35+
distribution: goreleaser
36+
version: latest
37+
args: release --rm-dist
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GH_CLASS_VERSION_TRACKER_TOKEN }}
40+
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
41+
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

.goreleaser.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
project_name: class-version-tracker
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
- go generate ./...
7+
builds:
8+
- env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- darwin
12+
- windows
13+
- linux
14+
goarch:
15+
- 386
16+
- amd64
17+
- arm64
18+
archives:
19+
- name_template: "{{ .ProjectName }}_{{ .Tag }}_{{ .Os }}_{{ .Arch }}"
20+
format_overrides:
21+
- goos: windows
22+
format: zip
23+
snapshot:
24+
name_template: "{{ incpatch .Version }}"

0 commit comments

Comments
 (0)