Skip to content

Commit d5f36c2

Browse files
committed
feta: 使用 workflow 发布
1 parent a1dd57f commit d5f36c2

File tree

2 files changed

+64
-5
lines changed

2 files changed

+64
-5
lines changed

.github/workflows/docker.yml

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Docker Image CI
33
on:
44
push:
55
branches: [ "main" ]
6-
pull_request:
7-
branches: [ "main" ]
6+
tags:
7+
- "v*"
88

99
jobs:
1010
docker-hub:
@@ -29,7 +29,7 @@ jobs:
2929
context: .
3030
file: ./Dockerfile
3131
push: true
32-
tags: xcsoft/busuanzi:latest
32+
tags: xcsoft/busuanzi:${{ github.ref }}
3333

3434
github-docker:
3535
runs-on: ubuntu-latest
@@ -54,4 +54,42 @@ jobs:
5454
context: .
5555
file: ./Dockerfile
5656
push: true
57-
tags: ghcr.io/soxft/busuanzi:latest
57+
tags: ghcr.io/soxft/busuanzi:${{ github.ref }}
58+
59+
build:
60+
runs-on: ubuntu-latest
61+
steps:
62+
- name: Checkout
63+
uses: actions/checkout@v4
64+
65+
- name: Set up Go
66+
uses: actions/setup-go@v2
67+
with:
68+
go-version: 1.21
69+
70+
- name: Build
71+
run: |
72+
GOOS=linux GOARCH=amd64 go build -o busuanzi-linux-amd64
73+
GOOS=linux GOARCH=arm64 go build -o busuanzi-linux-arm64
74+
GOOS=darwin GOARCH=amd64 go build -o busuanzi-darwin-amd64
75+
GOOS=darwin GOARCH=arm64 go build -o busuanzi-darwin-arm64
76+
GOOS=windows GOARCH=amd64 go build -o busuanzi-windows-amd64.exe
77+
GOOS=windows GOARCH=arm64 go build -o busuanzi-windows-arm64.exe
78+
GOOS=windows GOARCH=386 go build -o busuanzi-windows-386.exe
79+
80+
- name: Archive
81+
uses: softprops/action-gh-release@v2
82+
if: startsWith(github.ref, 'refs/tags/')
83+
with:
84+
files: |
85+
busuanzi-linux-amd64
86+
busuanzi-linux-arm64
87+
busuanzi-darwin-amd64
88+
busuanzi-darwin-arm64
89+
busuanzi-windows-amd64.exe
90+
busuanzi-windows-arm64.exe
91+
busuanzi-windows-386.exe
92+
token: ${{ secrets.GITHUB_TOKEN }}
93+
release_name: ${{ github.ref }}
94+
tag_name: ${{ github.ref }}
95+
body: ${{ github.event.release.body }}

.github/workflows/test.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,25 @@ jobs:
2222
with:
2323
context: .
2424
file: ./Dockerfile
25-
push: false
25+
push: false
26+
27+
build:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Set up Go
34+
uses: actions/setup-go@v2
35+
with:
36+
go-version: 1.21
37+
38+
- name: Build
39+
run: |
40+
GOOS=linux GOARCH=amd64 go build -o busuanzi-linux-amd64
41+
GOOS=linux GOARCH=arm64 go build -o busuanzi-linux-arm64
42+
GOOS=darwin GOARCH=amd64 go build -o busuanzi-darwin-amd64
43+
GOOS=darwin GOARCH=arm64 go build -o busuanzi-darwin-arm64
44+
GOOS=windows GOARCH=amd64 go build -o busuanzi-windows-amd64.exe
45+
GOOS=windows GOARCH=arm64 go build -o busuanzi-windows-arm64.exe
46+
GOOS=windows GOARCH=386 go build -o busuanzi-windows-386.exe

0 commit comments

Comments
 (0)