88 pull_request :
99 branches :
1010 - " *"
11+ release :
12+ types : [published]
1113
1214jobs :
1315 changelog-check :
@@ -113,7 +115,7 @@ jobs:
113115 name : rpm/deb
114116 runs-on : ubuntu-22.04
115117 needs : linux-test
116- if : github.ref_name == 'master' || github.ref_name == 'ci'
118+ if : github.ref_name == 'master' || github.ref_name == 'ci' || github.event_name == 'release'
117119
118120 strategy :
119121 fail-fast : false
@@ -143,6 +145,26 @@ jobs:
143145 if : matrix.arch == runner.arch
144146 run : cargo build --release --workspace --exclude notedeck_release
145147
148+ - name : Create release tarball (Cross)
149+ if : matrix.arch != runner.arch
150+ run : |
151+ mkdir -p packages
152+ tar czf packages/notedeck-${{ matrix.arch }}-linux.tar.gz \
153+ -C target/${{ matrix.arch }}-unknown-linux-gnu/release notedeck
154+
155+ - name : Create release tarball (Native)
156+ if : matrix.arch == runner.arch
157+ run : |
158+ mkdir -p packages
159+ tar czf packages/notedeck-${{ matrix.arch }}-linux.tar.gz \
160+ -C target/release notedeck
161+
162+ - name : Upload tarball
163+ uses : actions/upload-artifact@v4
164+ with :
165+ name : notedeck-${{ matrix.arch }}-linux.tar.gz
166+ path : packages/notedeck-${{ matrix.arch }}-linux.tar.gz
167+
146168 - name : Build RPM (Cross)
147169 if : matrix.arch != runner.arch
148170 run : cargo generate-rpm -p crates/notedeck_chrome --target=${{ matrix.arch }}-unknown-linux-gnu
@@ -192,7 +214,7 @@ jobs:
192214 name : macOS dmg
193215 runs-on : macos-latest
194216 needs : macos-test
195- if : github.ref_name == 'master' || github.ref_name == 'ci'
217+ if : github.ref_name == 'master' || github.ref_name == 'ci' || github.event_name == 'release'
196218 env :
197219 NOTEDECK_APPLE_RELEASE_CERT_ID : ${{ secrets.NOTEDECK_APPLE_RELEASE_CERT_ID }}
198220 NOTEDECK_RELEASE_APPLE_ID : ${{ secrets.NOTEDECK_RELEASE_APPLE_ID }}
@@ -227,6 +249,18 @@ jobs:
227249 - name : Run macOS DMG Build Script
228250 run : ARCH=${{ matrix.arch }} ./scripts/macos_build.sh
229251
252+ - name : Create release tarball
253+ run : |
254+ mkdir -p packages
255+ tar czf packages/notedeck-${{ matrix.arch }}-macos.tar.gz \
256+ -C target/${{ matrix.arch }}-apple-darwin/release notedeck
257+
258+ - name : Upload tarball
259+ uses : actions/upload-artifact@v4
260+ with :
261+ name : notedeck-${{ matrix.arch }}-macos.tar.gz
262+ path : packages/notedeck-${{ matrix.arch }}-macos.tar.gz
263+
230264 - name : Upload DMG Artifact
231265 uses : actions/upload-artifact@v4
232266 with :
@@ -237,7 +271,7 @@ jobs:
237271 name : Windows Installer
238272 runs-on : windows-latest
239273 needs : windows-test
240- if : github.ref_name == 'master' || github.ref_name == 'ci'
274+ if : github.ref_name == 'master' || github.ref_name == 'ci' || github.event_name == 'release'
241275 strategy :
242276 fail-fast : false
243277 matrix :
@@ -324,7 +358,7 @@ jobs:
324358 name : Upload Artifacts to Server
325359 runs-on : ubuntu-22.04
326360 needs : [packaging, macos-dmg, windows-installer]
327- if : github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
361+ if : github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.event_name == 'release'
328362
329363 steps :
330364 - name : Download all Artifacts
@@ -349,6 +383,44 @@ jobs:
349383 put $ARTIFACTS/notedeck-aarch64.dmg/*
350384 put $ARTIFACTS/DamusNotedeckInstaller-x86_64.exe/*
351385 put $ARTIFACTS/DamusNotedeckInstaller-aarch64.exe/*
386+ put $ARTIFACTS/notedeck-x86_64-linux.tar.gz/*
387+ put $ARTIFACTS/notedeck-aarch64-linux.tar.gz/*
388+ put $ARTIFACTS/notedeck-x86_64-macos.tar.gz/*
389+ put $ARTIFACTS/notedeck-aarch64-macos.tar.gz/*
352390 bye
353391 EOF
354392
393+ upload-to-release :
394+ name : Upload to GitHub Release
395+ runs-on : ubuntu-22.04
396+ needs : [packaging, macos-dmg, windows-installer]
397+ if : github.event_name == 'release'
398+ permissions :
399+ contents : write
400+
401+ steps :
402+ - name : Download all Artifacts
403+ uses : actions/download-artifact@v4
404+
405+ - name : Upload assets to GitHub Release
406+ env :
407+ GH_TOKEN : ${{ github.token }}
408+ run : |
409+ tag="${{ github.event.release.tag_name }}"
410+ echo "=== Downloaded artifact directories ==="
411+ ls -la
412+ for dir in */; do
413+ echo "--- $dir ---"
414+ ls -la "$dir"
415+ done
416+ echo "=== Uploading to release $tag ==="
417+ for dir in notedeck-*.rpm notedeck-*.deb notedeck-*.dmg notedeck-*-linux.tar.gz notedeck-*-macos.tar.gz DamusNotedeckInstaller-*.exe; do
418+ if [ -d "$dir" ]; then
419+ for file in "$dir"/*; do
420+ [ -f "$file" ] || continue
421+ echo "uploading $file..."
422+ gh release upload "$tag" "$file" --repo "${{ github.repository }}" --clobber
423+ done
424+ fi
425+ done
426+
0 commit comments