Files
cinny-desktop/.gitea/workflows/build.yml
Max Litruv Boonzaayer 11cdf0acf2
Some checks failed
Build / build-windows (push) Successful in 6m5s
Build / build-android (push) Failing after 27s
Build / build-linux (push) Successful in 10m41s
Build / create-release (push) Successful in 15s
refactor: remove version check job and streamline release process
2026-02-19 18:34:01 +11:00

379 lines
14 KiB
YAML

name: Build
on:
push:
branches:
- main
- dev
tags:
- 'v*'
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
CARGO_INCREMENTAL: 1
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
jobs:
build-windows:
runs-on: windows
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.ref_name }}
clean: false
- name: Checkout submodules (Windows workaround)
shell: powershell
run: |
git submodule update --init --recursive
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install dependencies (root)
run: npm install --prefer-offline
- name: Install dependencies (cinny)
working-directory: ./cinny
run: npm install --prefer-offline
- name: Build Tauri app
run: npm run tauri build
- name: Rename MSI files
shell: powershell
run: |
$msi = Get-ChildItem "src-tauri/target/release/bundle/msi/*.msi" -Exclude "Cinny-*" | Select-Object -First 1
Copy-Item $msi.FullName "src-tauri/target/release/bundle/msi/Cinny-Windows-x64.msi"
$msiZip = Get-ChildItem "src-tauri/target/release/bundle/msi/*.msi.zip" -Exclude "Cinny-*" | Select-Object -First 1
if ($msiZip) { Copy-Item $msiZip.FullName "src-tauri/target/release/bundle/msi/Cinny-Windows-x64.msi.zip" }
$msiZipSig = Get-ChildItem "src-tauri/target/release/bundle/msi/*.msi.zip.sig" -Exclude "Cinny-*" | Select-Object -First 1
if ($msiZipSig) { Copy-Item $msiZipSig.FullName "src-tauri/target/release/bundle/msi/Cinny-Windows-x64.msi.zip.sig" }
Get-ChildItem "src-tauri/target/release/bundle/msi/"
- name: Upload MSI installer
uses: actions/upload-artifact@v3
with:
name: Cinny-Windows-x64.msi
path: src-tauri/target/release/bundle/msi/Cinny-Windows-x64.msi
- name: Upload MSI updater zip
uses: actions/upload-artifact@v3
if: always()
with:
name: Cinny-Windows-x64.msi.zip
path: src-tauri/target/release/bundle/msi/Cinny-Windows-x64.msi.zip
- name: Upload MSI updater signature
uses: actions/upload-artifact@v3
if: always()
with:
name: Cinny-Windows-x64.msi.zip.sig
path: src-tauri/target/release/bundle/msi/Cinny-Windows-x64.msi.zip.sig
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ github.ref_name }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev rpm patchelf xdg-utils
- name: Install dependencies (root)
run: npm ci --prefer-offline
- name: Install dependencies (cinny)
working-directory: ./cinny
run: npm ci --prefer-offline
- name: Build Tauri app
run: npm run tauri build
- name: Rename Linux packages
run: |
# Find and copy each file individually to avoid glob issues
find src-tauri/target/release/bundle/appimage -name "*.AppImage" -not -name "Cinny-Linux*" | head -1 | xargs -I {} cp {} src-tauri/target/release/bundle/appimage/Cinny-Linux-x64.AppImage
find src-tauri/target/release/bundle/deb -name "*.deb" -not -name "Cinny-Linux*" | head -1 | xargs -I {} cp {} src-tauri/target/release/bundle/deb/Cinny-Linux-x64.deb
find src-tauri/target/release/bundle/rpm -name "*.rpm" -not -name "Cinny-Linux*" | head -1 | xargs -I {} cp {} src-tauri/target/release/bundle/rpm/Cinny-Linux-x64.rpm
# Copy signature file for updater if it exists
if ls src-tauri/target/release/bundle/appimage/*.AppImage.sig 1> /dev/null 2>&1; then
find src-tauri/target/release/bundle/appimage -name "*.AppImage.sig" -not -name "Cinny-Linux*" | head -1 | xargs -I {} cp {} src-tauri/target/release/bundle/appimage/Cinny-Linux-x64.AppImage.sig
fi
# List what we have
ls -la src-tauri/target/release/bundle/appimage/
ls -la src-tauri/target/release/bundle/deb/
ls -la src-tauri/target/release/bundle/rpm/
- name: Upload AppImage
uses: actions/upload-artifact@v3
with:
name: Cinny-Linux-x64.AppImage
path: src-tauri/target/release/bundle/appimage/Cinny-Linux-x64.AppImage
- name: Upload AppImage Signature
uses: actions/upload-artifact@v3
if: always()
with:
name: Cinny-Linux-x64.AppImage.sig
path: src-tauri/target/release/bundle/appimage/Cinny-Linux-x64.AppImage.sig
- name: Upload DEB package
uses: actions/upload-artifact@v3
with:
name: Cinny-Linux-x64.deb
path: src-tauri/target/release/bundle/deb/Cinny-Linux-x64.deb
- name: Upload RPM package
uses: actions/upload-artifact@v3
with:
name: Cinny-Linux-x64.rpm
path: src-tauri/target/release/bundle/rpm/Cinny-Linux-x64.rpm
build-android:
runs-on: windows
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ github.ref_name }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: aarch64-linux-android
- name: Add Android targets
run: |
rustup target add aarch64-linux-android --toolchain stable
- name: Install dependencies (root)
run: npm ci --prefer-offline
- name: Install dependencies (cinny)
working-directory: ./cinny
run: npm ci --prefer-offline
- name: Build Android APK
shell: powershell
run: |
$env:PATH = "$env:USERPROFILE\.cargo\bin;$env:PATH"
npm run tauri android build -- --ci --target aarch64
env:
ANDROID_HOME: ${{ env.ANDROID_HOME }}
NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/25.2.9519653
RUSTUP_TOOLCHAIN: stable
CI: true
- name: Sign APK
shell: powershell
run: |
$unsignedApk = "src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned.apk"
$signedApk = "src-tauri/gen/android/app/build/outputs/apk/universal/release/cinny-release.apk"
$keystoreDir = "$env:USERPROFILE\.android"
$keystore = "$keystoreDir\debug.keystore"
# Find Android SDK
$androidHome = if ($env:ANDROID_HOME) { $env:ANDROID_HOME }
elseif ($env:ANDROID_SDK_ROOT) { $env:ANDROID_SDK_ROOT }
elseif (Test-Path "$env:LOCALAPPDATA\Android\Sdk") { "$env:LOCALAPPDATA\Android\Sdk" }
else { "$env:USERPROFILE\AppData\Local\Android\Sdk" }
Write-Host "Using Android SDK at: $androidHome"
# Ensure keystore directory exists
if (-not (Test-Path $keystoreDir)) {
New-Item -ItemType Directory -Path $keystoreDir -Force | Out-Null
}
# Use debug keystore for signing (create if missing)
if (-not (Test-Path $keystore)) {
Write-Host "Creating debug keystore..."
# Use -noprompt to avoid any interactive prompts
& keytool -genkeypair -noprompt -keystore $keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Android Debug,O=Android,C=US"
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to create keystore"
exit 1
}
}
Write-Host "Using keystore: $keystore"
# Find build tools
$buildTools = Get-ChildItem "$androidHome\build-tools" | Sort-Object Name -Descending | Select-Object -First 1
$apksigner = "$($buildTools.FullName)\apksigner.bat"
$zipalign = "$($buildTools.FullName)\zipalign.exe"
Write-Host "Using build tools: $($buildTools.FullName)"
# Align the APK
Write-Host "Aligning APK..."
& $zipalign -v -p 4 $unsignedApk "$unsignedApk.aligned"
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to align APK"
exit 1
}
# Sign the APK
Write-Host "Signing APK..."
& $apksigner sign --ks $keystore --ks-pass pass:android --key-pass pass:android --out $signedApk "$unsignedApk.aligned"
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to sign APK"
exit 1
}
# Verify
Write-Host "Verifying signature..."
& $apksigner verify $signedApk
Write-Host "Signed APK created at: $signedApk"
# Rename to final name
Copy-Item $signedApk "src-tauri/gen/android/app/build/outputs/apk/universal/release/Cinny-Android.apk"
Write-Host "Done! APK ready at: Cinny-Android.apk"
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: Cinny-Android.apk
path: src-tauri/gen/android/app/build/outputs/apk/universal/release/Cinny-Android.apk
create-release:
runs-on: ubuntu-latest
needs: [build-windows, build-linux, build-android]
if: always() && (needs.build-windows.result == 'success' || needs.build-linux.result == 'success')
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version
id: version
run: |
VERSION=$(grep -Po '"version":\s*"\K[^"]+' src-tauri/tauri.conf.json | head -1)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Check if tag exists
id: tag_check
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
echo "Tag v$VERSION already exists"
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "Tag v$VERSION does not exist"
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Create and push tag
if: steps.tag_check.outputs.exists == 'false'
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git tag -a "v${{ steps.version.outputs.VERSION }}" -m "Release v${{ steps.version.outputs.VERSION }}"
git push origin "v${{ steps.version.outputs.VERSION }}"
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Create update.json
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
APPIMAGE_SIG=""
MSI_SIG=""
if [ -f "artifacts/Cinny-Linux-x64.AppImage.sig/Cinny-Linux-x64.AppImage.sig" ]; then
APPIMAGE_SIG=$(cat "artifacts/Cinny-Linux-x64.AppImage.sig/Cinny-Linux-x64.AppImage.sig")
fi
if [ -f "artifacts/Cinny-Windows-x64.msi.zip.sig/Cinny-Windows-x64.msi.zip.sig" ]; then
MSI_SIG=$(cat "artifacts/Cinny-Windows-x64.msi.zip.sig/Cinny-Windows-x64.msi.zip.sig")
fi
cat > update.json << EOF
{
"version": "${VERSION}",
"notes": "Update to version ${VERSION}",
"pub_date": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"platforms": {
"linux-x86_64": {
"signature": "${APPIMAGE_SIG}",
"url": "http://synbox.ruv.wtf:8418/litruv/cinny-desktop/releases/download/v${VERSION}/Cinny-Linux-x64.AppImage"
},
"windows-x86_64": {
"signature": "${MSI_SIG}",
"url": "http://synbox.ruv.wtf:8418/litruv/cinny-desktop/releases/download/v${VERSION}/Cinny-Windows-x64.msi.zip"
}
}
}
EOF
cat update.json
- name: Prepare release files
run: |
mkdir -p release-files
find artifacts -type f \( -name "*.msi" -o -name "*.msi.zip" -o -name "*.msi.zip.sig" -o -name "*.AppImage" -o -name "*.deb" -o -name "*.rpm" -o -name "*.apk" -o -name "*.sig" \) -exec cp {} release-files/ \;
cp update.json release-files/
ls -la release-files/
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.VERSION }}
files: release-files/*
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}