@@ -9,119 +9,25 @@ permissions:
99 contents : write # Required for creating releases and uploading assets
1010
1111jobs :
12- build :
13- name : Build
12+ release :
13+ name : Release
1414 runs-on : ubuntu-latest
1515
16- strategy :
17- matrix :
18- include :
19- - goos : linux
20- goarch : amd64
21- binary_name : que
22- - goos : linux
23- goarch : arm64
24- binary_name : que
25- - goos : darwin
26- goarch : amd64
27- binary_name : que
28- - goos : darwin
29- goarch : arm64
30- binary_name : que
31- - goos : windows
32- goarch : amd64
33- binary_name : que.exe
34- - goos : windows
35- goarch : arm64
36- binary_name : que.exe
37-
3816 steps :
3917 - name : Checkout code
4018 uses : actions/checkout@v4
19+ with :
20+ fetch-depth : 0 # Required for changelog generation
4121
4222 - name : Set up Go
4323 uses : actions/setup-go@v5
4424 with :
4525 go-version-file : ' go.mod'
4626
47- - name : Get tag name
48- id : tag
49- run : echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
50-
51- - name : Verify project structure
52- run : |
53- pwd
54- ls -la
55- test -d cmd/que || (echo "ERROR: cmd/que directory not found!" && exit 1)
56- test -f cmd/que/main.go || (echo "ERROR: cmd/que/main.go not found!" && exit 1)
57-
58- - name : Build binary
59- env :
60- GOOS : ${{ matrix.goos }}
61- GOARCH : ${{ matrix.goarch }}
62- CGO_ENABLED : 0
63- run : |
64- go build -ldflags="-s -w -X main.Version=${{ steps.tag.outputs.TAG_NAME }}" \
65- -o ${{ matrix.binary_name }} \
66- github.com/jenian/que/cmd/que
67-
68- - name : Create archive
69- shell : bash
70- run : |
71- if [ "${{ matrix.goos }}" == "windows" ]; then
72- zip que-${{ matrix.goos }}-${{ matrix.goarch }}.zip ${{ matrix.binary_name }}
73- else
74- tar -czf que-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz ${{ matrix.binary_name }}
75- fi
76-
77- - name : Upload artifacts
78- uses : actions/upload-artifact@v4
27+ - name : Run GoReleaser
28+ uses : goreleaser/goreleaser-action@v6
7929 with :
80- name : que-${{ matrix.goos }}-${{ matrix.goarch }}
81- path : que-${{ matrix.goos }}-${{ matrix.goarch }}.*
82-
83- release :
84- name : Create Release
85- needs : build
86- runs-on : ubuntu-latest
87- if : startsWith(github.ref, 'refs/tags/')
88-
89- steps :
90- - name : Checkout code
91- uses : actions/checkout@v4
92-
93- - name : Get tag name
94- id : tag
95- run : echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
96-
97- - name : Download all artifacts
98- uses : actions/download-artifact@v4
99- with :
100- path : ./artifacts
101-
102- - name : Create checksums
103- shell : bash
104- working-directory : artifacts
105- run : |
106- # Only checksum the archive files
107- find . -type f \( -name "*.tar.gz" -o -name "*.zip" \) | sort | while read file; do
108- if command -v sha256sum > /dev/null; then
109- sha256sum "$file" >> checksums.txt
110- elif command -v shasum > /dev/null; then
111- shasum -a 256 "$file" >> checksums.txt
112- fi
113- done
114-
115- - name : Create Release
116- uses : softprops/action-gh-release@v2
117- with :
118- tag_name : ${{ steps.tag.outputs.TAG_NAME }}
119- name : Release ${{ steps.tag.outputs.TAG_NAME }}
120- files : |
121- artifacts/**/*.tar.gz
122- artifacts/**/*.zip
123- artifacts/checksums.txt
124- generate_release_notes : true
125- draft : false
126- prerelease : ${{ contains(steps.tag.outputs.TAG_NAME, '-') }}
127-
30+ version : latest
31+ args : release --clean
32+ env :
33+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments