2727 with :
2828 ref : ${{ inputs.commit_sha || github.sha }}
2929
30+ - name : Extract version from cabal file
31+ run : |
32+ VERSION=$(grep -E '^version:' kda-tool.cabal | awk '{print $2}')
33+ echo "VERSION=$VERSION" >> $GITHUB_ENV
34+
35+
3036 # Haskell Setup
3137 - name : Set permissions for .ghcup (ubuntu)
3238 if : startsWith(matrix.os, 'ubuntu-')
@@ -106,7 +112,7 @@ jobs:
106112
107113 - name : Restore Cabal store
108114 id : restore-cabal
109- uses : actions/cache/restore@v4
115+ uses : actions/cache/restore@v5
110116 with :
111117 path : ~/.cabal/store
112118 key : cabal-${{ matrix.os }}-${{ matrix.ghc }}-${{ steps.cache-key.outputs.freeze-hash }}
@@ -120,7 +126,7 @@ jobs:
120126
121127 - name : Cache Cabal store if necessary
122128 if : steps.restore-cabal.outputs.cache-hit != 'true'
123- uses : actions/cache/save@v4
129+ uses : actions/cache/save@v5
124130 with :
125131 path : ~/.cabal/store
126132 key : cabal-${{ matrix.os }}-${{ matrix.ghc }}-${{ steps.cache-key.outputs.freeze-hash }}
@@ -131,5 +137,64 @@ jobs:
131137
132138 - name : Verify Binary Linking
133139 shell : bash
134- if : " !contains(matrix.flags, '-build-tool')"
135- run : cabal run exe:kda -- --version
140+ run : cabal run exe:kda -- --help
141+
142+ - name : Extract version and set up variables
143+ shell : bash
144+ run : |
145+ VERSION=$(cabal run exe:kda -- --version)
146+ echo "VERSION=$VERSION" >> $GITHUB_ENV
147+ echo "ARCHIVE_DIR=kda-tool-$VERSION" >> $GITHUB_ENV
148+ echo "ARCHIVE_NAME=kda-tool-$VERSION-${{matrix.os}}" >> $GITHUB_ENV
149+
150+ - name : Prepare release artifact
151+ shell : bash
152+ run : |
153+ OUTPUT_DIR=artifacts/$ARCHIVE_DIR
154+ mkdir -p $OUTPUT_DIR
155+ cp $(cabal list-bin kda) $OUTPUT_DIR
156+ cp CHANGELOG.md $OUTPUT_DIR
157+ cp README.md $OUTPUT_DIR
158+ cp LICENSE $OUTPUT_DIR
159+
160+ - name : Strip binary
161+ shell : bash
162+ run : strip artifacts/$ARCHIVE_DIR/kda
163+
164+ - name : Build release archive
165+ shell : bash
166+ run : |
167+ cd artifacts
168+ tar czf $ARCHIVE_NAME.tar.gz $ARCHIVE_DIR
169+
170+ - name : Upload artifact
171+ uses : actions/upload-artifact@v6
172+ with :
173+ name : release-arch-${{matrix.os}}
174+ retention-days : 1
175+ path : artifacts/*.tar.gz
176+
177+ merge :
178+ needs : build
179+ runs-on : ubuntu-latest
180+
181+ steps :
182+ - name : Download All artifacts
183+ uses : actions/download-artifact@v6
184+ with :
185+ path : artifacts
186+ pattern : release-arch-*
187+ merge-multiple : true
188+
189+ - name : Compute Cheksums
190+ shell : bash
191+ run : |
192+ cd artifacts
193+ sha256sum * > SHA256SUMS
194+
195+ - name : Upload artifact
196+ uses : actions/upload-artifact@v6
197+ with :
198+ name : releases
199+ retention-days : 30
200+ path : artifacts/*.tar.gz
0 commit comments