@@ -80,12 +80,17 @@ jobs:
8080 name : ${{ matrix.goos }}-${{ matrix.goarch }}
8181 path : ${{ matrix.name }}
8282
83- create-release-assets :
84- name : Create Release Assets
83+ create-release :
84+ name : Create GitHub Release
8585 runs-on : ubuntu-latest
8686 needs : build
87- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
87+ if : startsWith(github.ref, 'refs/tags/v')
88+ permissions :
89+ contents : write
8890 steps :
91+ - name : Checkout code
92+ uses : actions/checkout@v4
93+
8994 - name : Download all artifacts
9095 uses : actions/download-artifact@v4
9196 with :
@@ -94,16 +99,38 @@ jobs:
9499 - name : Display structure of downloaded files
95100 run : ls -R artifacts/
96101
97- - name : Archive binaries
102+ - name : Create release archives
98103 run : |
99104 cd artifacts
100- for dir in */; do
101- tar czf "${dir%/}.tar.gz" -C "$dir" .
105+ # Create tar.gz for Linux and macOS
106+ for dir in linux-* darwin-*; do
107+ if [ -d "$dir" ]; then
108+ tar czf "${dir}.tar.gz" -C "$dir" .
109+ fi
110+ done
111+ # Create zip for Windows
112+ for dir in windows-*; do
113+ if [ -d "$dir" ]; then
114+ cd "$dir"
115+ zip -r "../${dir}.zip" .
116+ cd ..
117+ fi
102118 done
103- cd ..
119+ ls -lh
104120
105- - name : Upload combined artifacts
106- uses : actions/upload-artifact@v4
121+ - name : Extract version from tag
122+ id : version
123+ run : echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
124+
125+ - name : Create Release
126+ uses : softprops/action-gh-release@v1
107127 with :
108- name : all-binaries
109- path : artifacts/*.tar.gz
128+ name : Release ${{ steps.version.outputs.VERSION }}
129+ draft : false
130+ prerelease : false
131+ generate_release_notes : true
132+ files : |
133+ artifacts/*.tar.gz
134+ artifacts/*.zip
135+ env :
136+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments