1
+ name : Release
2
+ # on:
3
+ # push:
4
+ # tags: [ v* ]
5
+ on :
6
+ push :
7
+ branches :
8
+ - " **"
9
+
10
+ env :
11
+ GO_VERSION : 1.23
12
+ REPO : ${{ github.repository }}
13
+
14
+ jobs :
15
+ build :
16
+ runs-on : ubuntu-latest
17
+ strategy :
18
+ matrix :
19
+ GOOS : [linux, darwin, windows]
20
+ GOARCH : [amd64, arm64]
21
+ include :
22
+ - GOOS : windows
23
+ ext : .exe
24
+ steps :
25
+ - uses : actions/checkout@v4
26
+
27
+ - name : Set up Go
28
+ uses : actions/setup-go@v5
29
+ with :
30
+ go-version : ${{ env.GO_VERSION }}
31
+
32
+ - name : Repo Name
33
+ id : repo-name
34
+ run : echo name=$(basename ${{ github.repository }}) >> $GITHUB_OUTPUT
35
+
36
+ - name : Test
37
+ run : go test -v ./...
38
+
39
+ - name : Build
40
+ run : make package PROGRAM=${{ env.GOOS }}-${{ env.GOARCH }}/${{ steps.repo-name.outputs.name }}${{ matrix.ext }} PACKAGE=dist/${{ steps.repo-name.outputs.name }}-${{ matrix.GOOS }}-${{ matrix.GOARCH }}.zip
41
+ env :
42
+ GOOS : ${{ matrix.GOOS }}
43
+ GOARCH : ${{ matrix.GOARCH }}
44
+
45
+ - name : ' Upload Artifact'
46
+ uses : actions/upload-artifact@v4
47
+ with :
48
+ name : artifacts-${{ matrix.GOOS }}-${{ matrix.GOARCH }}
49
+ path : dist
50
+ retention-days : 1
51
+ if-no-files-found : error
52
+
53
+ release :
54
+ runs-on : ubuntu-latest
55
+ needs :
56
+ - build
57
+ steps :
58
+ - uses : actions/checkout@v4
59
+ with :
60
+ fetch-depth : 0
61
+
62
+ - name : Download Artifacts
63
+ uses : actions/download-artifact@v4
64
+ with :
65
+ path : artifacts
66
+ pattern : artifacts-*
67
+ merge-multiple : true
68
+
69
+ - name : Install ChangeLog generator
70
+ run : |
71
+ wget https://github.com/git-chglog/git-chglog/releases/download/v0.15.1/git-chglog_0.15.1_linux_amd64.tar.gz
72
+ tar xzf git-chglog*.tar.gz git-chglog
73
+ - name : " Get Last Release"
74
+ id : last_release
75
+
76
+ with :
77
+ myToken : ${{ github.token }}
78
+ exclude_types : " draft|prerelease"
79
+
80
+ - name : Generate Changelog for ${{ github.ref_name }}
81
+ id : generate-changelog
82
+ run : PATH="${PATH}:." make CHANGELOG.md
83
+
84
+ - name : Generate checksum
85
+ run : |
86
+ cd artifacts
87
+ for file in *; do shasum -a 256 "$file" >> checksum.txt; done
88
+
89
+ - name : Create Release
90
+ id : create_release
91
+ uses : softprops/action-gh-release@v2
92
+ with :
93
+ files : |
94
+ ./artifacts/*
95
+ body_path : ./CHANGELOG.md
96
+ draft : false
0 commit comments