Standardize artifact uploads and enable tauri arm64 cross-build

This commit is contained in:
Shantur Rathore
2025-11-21 18:31:45 +00:00
parent a088b948b4
commit dbbed94381
4 changed files with 62 additions and 75 deletions

View File

@@ -55,16 +55,10 @@ jobs:
run: | run: |
set -euo pipefail set -euo pipefail
shopt -s nullglob shopt -s nullglob
for file in packages/electron-app/release/*; do for file in packages/electron-app/release/*.zip; do
[ -f "$file" ] || continue [ -f "$file" ] || continue
case "$file" in echo "Uploading $file"
*.dmg|*.zip)
gh release upload "$TAG" "$file" --clobber gh release upload "$TAG" "$file" --clobber
;;
*)
echo "Skipping non-installer asset: $file"
;;
esac
done done
build-windows: build-windows:
@@ -99,9 +93,8 @@ jobs:
- name: Upload release assets - name: Upload release assets
shell: pwsh shell: pwsh
run: | run: |
Get-ChildItem -Path "packages/electron-app/release" -File | Where-Object { Get-ChildItem -Path "packages/electron-app/release" -Filter *.zip -File | ForEach-Object {
$_.Name -match '\\.(exe|zip)$' Write-Host "Uploading $($_.FullName)"
} | ForEach-Object {
gh release upload $env:TAG $_.FullName --clobber gh release upload $env:TAG $_.FullName --clobber
} }
@@ -137,16 +130,10 @@ jobs:
run: | run: |
set -euo pipefail set -euo pipefail
shopt -s nullglob shopt -s nullglob
for file in packages/electron-app/release/*; do for file in packages/electron-app/release/*.zip; do
[ -f "$file" ] || continue [ -f "$file" ] || continue
case "$file" in echo "Uploading $file"
*.AppImage|*.deb|*.tar.gz)
gh release upload "$TAG" "$file" --clobber gh release upload "$TAG" "$file" --clobber
;;
*)
echo "Skipping non-installer asset: $file"
;;
esac
done done
build-tauri-macos: build-tauri-macos:
@@ -190,16 +177,14 @@ jobs:
if [ -d "$BUNDLE_ROOT/macos/CodeNomad.app" ]; then if [ -d "$BUNDLE_ROOT/macos/CodeNomad.app" ]; then
ditto -ck --sequesterRsrc --keepParent "$BUNDLE_ROOT/macos/CodeNomad.app" "$ARTIFACT_DIR/CodeNomad-Tauri-${VERSION}-macos-x64.zip" ditto -ck --sequesterRsrc --keepParent "$BUNDLE_ROOT/macos/CodeNomad.app" "$ARTIFACT_DIR/CodeNomad-Tauri-${VERSION}-macos-x64.zip"
fi fi
if [ -f "$BUNDLE_ROOT/dmg/CodeNomad.dmg" ]; then
cp "$BUNDLE_ROOT/dmg/CodeNomad.dmg" "$ARTIFACT_DIR/CodeNomad-Tauri-${VERSION}-macos-x64.dmg"
fi
- name: Upload Tauri release assets (macOS) - name: Upload Tauri release assets (macOS)
run: | run: |
set -euo pipefail set -euo pipefail
shopt -s nullglob shopt -s nullglob
for file in packages/tauri-app/release-tauri/*; do for file in packages/tauri-app/release-tauri/*.zip; do
[ -f "$file" ] || continue [ -f "$file" ] || continue
echo "Uploading $file"
gh release upload "$TAG" "$file" --clobber gh release upload "$TAG" "$file" --clobber
done done
@@ -244,16 +229,14 @@ jobs:
if [ -d "$BUNDLE_ROOT/macos/CodeNomad.app" ]; then if [ -d "$BUNDLE_ROOT/macos/CodeNomad.app" ]; then
ditto -ck --sequesterRsrc --keepParent "$BUNDLE_ROOT/macos/CodeNomad.app" "$ARTIFACT_DIR/CodeNomad-Tauri-${VERSION}-macos-arm64.zip" ditto -ck --sequesterRsrc --keepParent "$BUNDLE_ROOT/macos/CodeNomad.app" "$ARTIFACT_DIR/CodeNomad-Tauri-${VERSION}-macos-arm64.zip"
fi fi
if [ -f "$BUNDLE_ROOT/dmg/CodeNomad.dmg" ]; then
cp "$BUNDLE_ROOT/dmg/CodeNomad.dmg" "$ARTIFACT_DIR/CodeNomad-Tauri-${VERSION}-macos-arm64.dmg"
fi
- name: Upload Tauri release assets (macOS arm64) - name: Upload Tauri release assets (macOS arm64)
run: | run: |
set -euo pipefail set -euo pipefail
shopt -s nullglob shopt -s nullglob
for file in packages/tauri-app/release-tauri/*; do for file in packages/tauri-app/release-tauri/*.zip; do
[ -f "$file" ] || continue [ -f "$file" ] || continue
echo "Uploading $file"
gh release upload "$TAG" "$file" --clobber gh release upload "$TAG" "$file" --clobber
done done
@@ -296,17 +279,18 @@ jobs:
$artifactDir = "packages/tauri-app/release-tauri" $artifactDir = "packages/tauri-app/release-tauri"
if (Test-Path $artifactDir) { Remove-Item $artifactDir -Recurse -Force } if (Test-Path $artifactDir) { Remove-Item $artifactDir -Recurse -Force }
New-Item -ItemType Directory -Path $artifactDir | Out-Null New-Item -ItemType Directory -Path $artifactDir | Out-Null
Get-ChildItem -Path $bundleRoot -Recurse -File | Where-Object { $_.Extension -in '.exe', '.msi' } | ForEach-Object { $artifact = Get-ChildItem -Path $bundleRoot -Recurse -File | Where-Object { $_.Extension -in '.exe', '.msi' } | Select-Object -First 1
$ext = $_.Extension.TrimStart('.') if ($null -ne $artifact) {
$dest = Join-Path $artifactDir ("CodeNomad-Tauri-$env:VERSION-windows-x64.$ext") $dest = Join-Path $artifactDir ("CodeNomad-Tauri-$env:VERSION-windows-x64.zip")
Copy-Item $_.FullName $dest -Force Compress-Archive -Path $artifact.FullName -DestinationPath $dest -Force
} }
- name: Upload Tauri release assets (Windows) - name: Upload Tauri release assets (Windows)
shell: pwsh shell: pwsh
run: | run: |
if (Test-Path "packages/tauri-app/release-tauri") { if (Test-Path "packages/tauri-app/release-tauri") {
Get-ChildItem -Path "packages/tauri-app/release-tauri" -File | ForEach-Object { Get-ChildItem -Path "packages/tauri-app/release-tauri" -Filter *.zip -File | ForEach-Object {
Write-Host "Uploading $($_.FullName)"
gh release upload $env:TAG $_.FullName --clobber gh release upload $env:TAG $_.FullName --clobber
} }
} }
@@ -363,23 +347,23 @@ jobs:
rm -rf "$ARTIFACT_DIR" rm -rf "$ARTIFACT_DIR"
mkdir -p "$ARTIFACT_DIR" mkdir -p "$ARTIFACT_DIR"
shopt -s nullglob globstar shopt -s nullglob globstar
for file in "$BUNDLE_ROOT"/**/*.{AppImage,deb,rpm,tar.gz}; do first_artifact=$(find "$BUNDLE_ROOT" -type f \( -name "*.AppImage" -o -name "*.deb" -o -name "*.rpm" -o -name "*.tar.gz" \) | head -n1)
[ -f "$file" ] || continue if [ -n "$first_artifact" ]; then
ext="${file##*.}" zip -j "$ARTIFACT_DIR/CodeNomad-Tauri-${VERSION}-linux-x64.zip" "$first_artifact"
cp "$file" "$ARTIFACT_DIR/CodeNomad-Tauri-${VERSION}-linux-x64.${ext}" fi
done
- name: Upload Tauri release assets (Linux) - name: Upload Tauri release assets (Linux)
run: | run: |
set -euo pipefail set -euo pipefail
shopt -s nullglob shopt -s nullglob
for file in packages/tauri-app/release-tauri/*; do for file in packages/tauri-app/release-tauri/*.zip; do
[ -f "$file" ] || continue [ -f "$file" ] || continue
echo "Uploading $file"
gh release upload "$TAG" "$file" --clobber gh release upload "$TAG" "$file" --clobber
done done
build-tauri-linux-arm64: build-tauri-linux-arm64:
runs-on: ubuntu-24.04-arm64 runs-on: ubuntu-24.04
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ inputs.version }} VERSION: ${{ inputs.version }}
@@ -388,6 +372,11 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
@@ -396,19 +385,24 @@ jobs:
- name: Setup Rust (Tauri) - name: Setup Rust (Tauri)
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-unknown-linux-gnu
- name: Install Linux build dependencies (Tauri) - name: Install Linux build dependencies (Tauri)
run: | run: |
sudo dpkg --add-architecture arm64
sudo apt-get update sudo apt-get update
sudo apt-get install -y \ sudo apt-get install -y \
build-essential \ build-essential \
pkg-config \ pkg-config \
libgtk-3-dev \ gcc-aarch64-linux-gnu \
libglib2.0-dev \ g++-aarch64-linux-gnu \
libwebkit2gtk-4.1-dev \ libgtk-3-dev:arm64 \
libsoup-3.0-dev \ libglib2.0-dev:arm64 \
libayatana-appindicator3-dev \ libwebkit2gtk-4.1-dev:arm64 \
librsvg2-dev libsoup-3.0-dev:arm64 \
libayatana-appindicator3-dev:arm64 \
librsvg2-dev:arm64
- name: Set workspace versions - name: Set workspace versions
run: npm version ${VERSION} --workspaces --include-workspace-root --no-git-tag-version --allow-same-version run: npm version ${VERSION} --workspaces --include-workspace-root --no-git-tag-version --allow-same-version
@@ -420,6 +414,12 @@ jobs:
run: npm install @rollup/rollup-linux-arm64-gnu --no-save run: npm install @rollup/rollup-linux-arm64-gnu --no-save
- name: Build Linux bundle (Tauri arm64) - name: Build Linux bundle (Tauri arm64)
env:
TAURI_BUILD_TARGET: aarch64-unknown-linux-gnu
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
CXX_aarch64_unknown_linux_gnu: aarch64-linux-gnu-g++
AR_aarch64_unknown_linux_gnu: aarch64-linux-gnu-ar
run: npm run build --workspace @codenomad/tauri-app run: npm run build --workspace @codenomad/tauri-app
- name: Package Tauri artifacts (Linux arm64) - name: Package Tauri artifacts (Linux arm64)
@@ -430,21 +430,22 @@ jobs:
rm -rf "$ARTIFACT_DIR" rm -rf "$ARTIFACT_DIR"
mkdir -p "$ARTIFACT_DIR" mkdir -p "$ARTIFACT_DIR"
shopt -s nullglob globstar shopt -s nullglob globstar
for file in "$BUNDLE_ROOT"/**/*.{AppImage,deb,rpm,tar.gz}; do first_artifact=$(find "$BUNDLE_ROOT" -type f \( -name "*.AppImage" -o -name "*.deb" -o -name "*.rpm" -o -name "*.tar.gz" \) | head -n1)
[ -f "$file" ] || continue if [ -n "$first_artifact" ]; then
ext="${file##*.}" zip -j "$ARTIFACT_DIR/CodeNomad-Tauri-${VERSION}-linux-arm64.zip" "$first_artifact"
cp "$file" "$ARTIFACT_DIR/CodeNomad-Tauri-${VERSION}-linux-arm64.${ext}" fi
done
- name: Upload Tauri release assets (Linux arm64) - name: Upload Tauri release assets (Linux arm64)
run: | run: |
set -euo pipefail set -euo pipefail
shopt -s nullglob shopt -s nullglob
for file in packages/tauri-app/release-tauri/*; do for file in packages/tauri-app/release-tauri/*.zip; do
[ -f "$file" ] || continue [ -f "$file" ] || continue
echo "Uploading $file"
gh release upload "$TAG" "$file" --clobber gh release upload "$TAG" "$file" --clobber
done done
build-linux-rpm: build-linux-rpm:
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
env: env:
@@ -481,8 +482,10 @@ jobs:
- name: Upload RPM release assets - name: Upload RPM release assets
run: | run: |
set -euo pipefail
shopt -s nullglob shopt -s nullglob
for file in packages/electron-app/release/*.rpm; do for file in packages/electron-app/release/*.rpm; do
[ -f "$file" ] || continue [ -f "$file" ] || continue
echo "Uploading $file"
gh release upload "$TAG" "$file" --clobber gh release upload "$TAG" "$file" --clobber
done done

View File

@@ -56,7 +56,7 @@ jobs:
secrets: inherit secrets: inherit
publish-server: publish-server:
needs: build-and-upload needs: prepare-dev
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read

View File

@@ -73,7 +73,7 @@ jobs:
secrets: inherit secrets: inherit
publish-server: publish-server:
needs: build-and-upload needs: prepare-release
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read

View File

@@ -76,7 +76,7 @@
"arch": ["x64", "arm64"] "arch": ["x64", "arm64"]
} }
], ],
"artifactName": "CodeNomadApp-${version}-${os}-${arch}.${ext}", "artifactName": "CodeNomad-${version}-${os}-${arch}.${ext}",
"icon": "electron/resources/icon.icns" "icon": "electron/resources/icon.icns"
}, },
"dmg": { "dmg": {
@@ -87,16 +87,12 @@
}, },
"win": { "win": {
"target": [ "target": [
{
"target": "nsis",
"arch": ["x64", "arm64"]
},
{ {
"target": "zip", "target": "zip",
"arch": ["x64", "arm64"] "arch": ["x64", "arm64"]
} }
], ],
"artifactName": "CodeNomadApp-${version}-${os}-${arch}.${ext}", "artifactName": "CodeNomad-${version}-${os}-${arch}.${ext}",
"icon": "electron/resources/icon.ico" "icon": "electron/resources/icon.ico"
}, },
"nsis": { "nsis": {
@@ -108,23 +104,11 @@
"linux": { "linux": {
"target": [ "target": [
{ {
"target": "AppImage", "target": "zip",
"arch": ["x64", "arm64"]
},
{
"target": "deb",
"arch": ["x64", "arm64"]
},
{
"target": "rpm",
"arch": ["x64", "arm64"]
},
{
"target": "tar.gz",
"arch": ["x64", "arm64"] "arch": ["x64", "arm64"]
} }
], ],
"artifactName": "CodeNomadApp-${version}-${os}-${arch}.${ext}", "artifactName": "CodeNomad-${version}-${os}-${arch}.${ext}",
"category": "Development", "category": "Development",
"icon": "electron/resources/icon.png" "icon": "electron/resources/icon.png"
} }