File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Build and publish to GitHub Releases when a version tag is pushed.
2+ # Push a tag like v1.0 or v0.9 to trigger: git tag v1.0 && git push origin v1.0
3+
4+ name : Release
5+
6+ on :
7+ push :
8+ tags :
9+ - ' v*'
10+
11+ permissions :
12+ contents : write
13+
14+ jobs :
15+ build :
16+ runs-on : ubuntu-latest
17+ strategy :
18+ matrix :
19+ include :
20+ - goos : linux
21+ goarch : amd64
22+ artifact : netspeed-linux-amd64
23+ suffix : ' '
24+ - goos : linux
25+ goarch : loong64
26+ artifact : netspeed-linux-loong64
27+ suffix : ' '
28+ - goos : windows
29+ goarch : amd64
30+ artifact : netspeed-windows-amd64
31+ suffix : ' .exe'
32+
33+ steps :
34+ - uses : actions/checkout@v4
35+
36+ - name : Set up Go
37+ uses : actions/setup-go@v5
38+ with :
39+ go-version : ' 1.20'
40+
41+ - name : Build
42+ env :
43+ GOOS : ${{ matrix.goos }}
44+ GOARCH : ${{ matrix.goarch }}
45+ run : go build -v -o ${{ matrix.artifact }}${{ matrix.suffix }} .
46+
47+ - name : Archive
48+ run : |
49+ zip ${{ matrix.artifact }}.zip ${{ matrix.artifact }}${{ matrix.suffix }}
50+
51+ - name : Upload artifact
52+ uses : actions/upload-artifact@v4
53+ with :
54+ name : ${{ matrix.artifact }}
55+ path : ${{ matrix.artifact }}.zip
56+
57+ release :
58+ needs : build
59+ runs-on : ubuntu-latest
60+ steps :
61+ - uses : actions/checkout@v4
62+
63+ - name : Download all artifacts
64+ uses : actions/download-artifact@v4
65+ with :
66+ path : artifacts
67+
68+ - name : Create Release
69+ uses : softprops/action-gh-release@v2
70+ with :
71+ files : artifacts/*/*.zip
72+ generate_release_notes : true
73+ env :
74+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments