Skip to content

Commit 2445406

Browse files
jb55claude
andcommitted
ci: add release tarballs and GitHub Release upload job
- Add release: published trigger to CI workflow - Create notedeck-{arch}-{os}.tar.gz tarballs in packaging and macOS jobs - Add upload-to-release job that attaches all artifacts to the GitHub Release - Update notedeck-release tool to accept any artifact by file extension instead of a hardcoded list Changelog-None: Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2c9e337 commit 2445406

2 files changed

Lines changed: 80 additions & 14 deletions

File tree

.github/workflows/rust.yml

Lines changed: 76 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
pull_request:
99
branches:
1010
- "*"
11+
release:
12+
types: [published]
1113

1214
jobs:
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+

crates/notedeck_release/src/main.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,8 @@ fn usage() {
2323

2424
const GITHUB_REPO: &str = "damus-io/notedeck";
2525

26-
const RELEASE_ARTIFACTS: &[&str] = &[
27-
"notedeck-x86_64-linux.tar.gz",
28-
"notedeck-aarch64-linux.tar.gz",
29-
"notedeck-x86_64-macos.tar.gz",
30-
"notedeck-aarch64-macos.tar.gz",
31-
"notedeck-x86_64-windows.zip",
32-
"notedeck-aarch64-windows.zip",
33-
];
26+
/// File extensions recognized as release artifacts
27+
const ARTIFACT_EXTENSIONS: &[&str] = &[".tar.gz", ".zip", ".dmg", ".deb", ".rpm", ".exe", ".msi"];
3428

3529
fn sha256_hex(data: &[u8]) -> String {
3630
let mut hasher = Sha256::new();
@@ -98,8 +92,8 @@ fn fetch_github_artifacts(version: &str) -> Result<Vec<ArtifactInfo>, String> {
9892
let mut artifacts = Vec::new();
9993
for asset in assets {
10094
let name = asset["name"].as_str().unwrap_or("").to_string();
101-
if !RELEASE_ARTIFACTS.contains(&name.as_str()) {
102-
eprintln!(" skipping unknown asset: {name}");
95+
if !ARTIFACT_EXTENSIONS.iter().any(|ext| name.ends_with(ext)) {
96+
eprintln!(" skipping non-artifact asset: {name}");
10397
continue;
10498
}
10599
let browser_url = asset["browser_download_url"]

0 commit comments

Comments
 (0)