electron
This commit is contained in:
@@ -8,12 +8,6 @@ on:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
env:
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
CARGO_INCREMENTAL: 1
|
||||
CARGO_NET_RETRY: 10
|
||||
RUSTUP_MAX_RETRIES: 10
|
||||
|
||||
jobs:
|
||||
increment-version:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -32,8 +26,8 @@ jobs:
|
||||
- name: Bump patch version
|
||||
id: bump
|
||||
run: |
|
||||
# Get current version
|
||||
CURRENT=$(grep -Po '"version":\s*"\K[^"]+' src-tauri/tauri.conf.json | head -1)
|
||||
# Get current version from package.json
|
||||
CURRENT=$(grep -Po '"version":\s*"\K[^"]+' package.json | head -1)
|
||||
echo "Current version: $CURRENT"
|
||||
|
||||
# Split and increment patch
|
||||
@@ -44,11 +38,11 @@ jobs:
|
||||
NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}"
|
||||
echo "New version: $NEW_VERSION"
|
||||
|
||||
# Update tauri.conf.json
|
||||
sed -i "s/\"version\": \"${CURRENT}\"/\"version\": \"${NEW_VERSION}\"/" src-tauri/tauri.conf.json
|
||||
# Update package.json
|
||||
sed -i "s/\"version\": \"${CURRENT}\"/\"version\": \"${NEW_VERSION}\"/" package.json
|
||||
|
||||
# Verify the change
|
||||
grep '"version"' src-tauri/tauri.conf.json | head -1
|
||||
grep '"version"' package.json | head -1
|
||||
|
||||
echo "VERSION=$NEW_VERSION" >> $GITHUB_OUTPUT
|
||||
echo "SHOULD_BUILD=true" >> $GITHUB_OUTPUT
|
||||
@@ -57,7 +51,7 @@ jobs:
|
||||
run: |
|
||||
git config user.name "GitHub Actions"
|
||||
git config user.email "actions@github.com"
|
||||
git add src-tauri/tauri.conf.json
|
||||
git add package.json
|
||||
git commit -m "chore: bump version to ${{ steps.bump.outputs.VERSION }} [skip ci]"
|
||||
git push
|
||||
|
||||
@@ -65,39 +59,24 @@ jobs:
|
||||
runs-on: windows
|
||||
needs: increment-version
|
||||
if: always() && (needs.increment-version.outputs.should_build == 'true' || needs.increment-version.result == 'skipped')
|
||||
env:
|
||||
CARGO_TARGET_DIR: C:\cargo-cache\cinny-desktop
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: false
|
||||
submodules: recursive
|
||||
ref: ${{ github.ref_name }}
|
||||
clean: false
|
||||
|
||||
- name: Pull latest (after version bump)
|
||||
if: github.ref == 'refs/heads/main'
|
||||
shell: powershell
|
||||
run: git pull origin main
|
||||
|
||||
- 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
|
||||
|
||||
@@ -105,80 +84,27 @@ jobs:
|
||||
working-directory: ./cinny
|
||||
run: npm install --prefer-offline
|
||||
|
||||
- name: Build Tauri app
|
||||
run: npm run tauri build
|
||||
- name: Build Electron app
|
||||
run: npm run build:win
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Copy and rename MSI files
|
||||
shell: powershell
|
||||
run: |
|
||||
# Clean and recreate output dir
|
||||
$outDir = "src-tauri/target/release/bundle/msi"
|
||||
if (Test-Path $outDir) { Remove-Item -Recurse -Force $outDir }
|
||||
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
|
||||
|
||||
# Find and copy MSI from cache location (get NEWEST file by LastWriteTime)
|
||||
$srcDir = "$env:CARGO_TARGET_DIR/release/bundle/msi"
|
||||
Write-Host "Looking for MSI in: $srcDir"
|
||||
Get-ChildItem $srcDir -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending
|
||||
|
||||
$msi = Get-ChildItem "$srcDir/*.msi" -ErrorAction Stop | Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
||||
Write-Host "Found MSI: $($msi.FullName) (Size: $($msi.Length) bytes, Modified: $($msi.LastWriteTime))"
|
||||
Copy-Item $msi.FullName "$outDir/Cinny-Windows-x64.msi" -Force
|
||||
|
||||
$msiZip = Get-ChildItem "$srcDir/*.msi.zip" -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
||||
if ($msiZip) {
|
||||
Write-Host "Found MSI.zip: $($msiZip.FullName)"
|
||||
Copy-Item $msiZip.FullName "$outDir/Cinny-Windows-x64.msi.zip" -Force
|
||||
}
|
||||
|
||||
$msiZipSig = Get-ChildItem "$srcDir/*.msi.zip.sig" -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
||||
if ($msiZipSig) {
|
||||
Write-Host "Found MSI.zip.sig: $($msiZipSig.FullName)"
|
||||
Copy-Item $msiZipSig.FullName "$outDir/Cinny-Windows-x64.msi.zip.sig" -Force
|
||||
}
|
||||
|
||||
$msiSig = Get-ChildItem "$srcDir/*.msi.sig" -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
||||
if ($msiSig) {
|
||||
Write-Host "Found MSI.sig: $($msiSig.FullName)"
|
||||
Copy-Item $msiSig.FullName "$outDir/Cinny-Windows-x64.msi.sig" -Force
|
||||
}
|
||||
|
||||
Write-Host "Final output:"
|
||||
Get-ChildItem $outDir
|
||||
|
||||
- name: Upload MSI installer
|
||||
- name: Upload NSIS installer
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Cinny-Windows-x64.msi
|
||||
path: src-tauri/target/release/bundle/msi/Cinny-Windows-x64.msi
|
||||
name: Paarrot-Windows-x64.exe
|
||||
path: dist-electron/Paarrot-*-win-x64.exe
|
||||
|
||||
- name: Upload MSI updater zip
|
||||
- name: Upload Portable
|
||||
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 (zip)
|
||||
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
|
||||
|
||||
- name: Upload MSI signature
|
||||
uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: Cinny-Windows-x64.msi.sig
|
||||
path: src-tauri/target/release/bundle/msi/Cinny-Windows-x64.msi.sig
|
||||
name: Paarrot-Windows-x64-portable.exe
|
||||
path: dist-electron/Paarrot-*-win-x64.portable.exe
|
||||
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
needs: increment-version
|
||||
if: always() && (needs.increment-version.outputs.should_build == 'true' || needs.increment-version.result == 'skipped')
|
||||
env:
|
||||
CARGO_TARGET_DIR: /home/runner/cargo-cache/cinny-desktop
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@@ -196,17 +122,10 @@ jobs:
|
||||
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
|
||||
sudo apt-get install -y rpm
|
||||
|
||||
- name: Install dependencies (root)
|
||||
run: npm ci --prefer-offline
|
||||
@@ -215,224 +134,32 @@ jobs:
|
||||
working-directory: ./cinny
|
||||
run: npm ci --prefer-offline
|
||||
|
||||
- name: Build Tauri app
|
||||
run: npm run tauri build
|
||||
|
||||
- name: Copy and rename Linux packages
|
||||
run: |
|
||||
# Clean and recreate workspace output directories
|
||||
rm -rf src-tauri/target/release/bundle/appimage
|
||||
rm -rf src-tauri/target/release/bundle/deb
|
||||
rm -rf src-tauri/target/release/bundle/rpm
|
||||
mkdir -p src-tauri/target/release/bundle/appimage
|
||||
mkdir -p src-tauri/target/release/bundle/deb
|
||||
mkdir -p src-tauri/target/release/bundle/rpm
|
||||
|
||||
# Show what's available in cache (sorted by time, newest first)
|
||||
echo "Available AppImage files:"
|
||||
ls -lt $CARGO_TARGET_DIR/release/bundle/appimage/ 2>/dev/null || true
|
||||
echo "Available DEB files:"
|
||||
ls -lt $CARGO_TARGET_DIR/release/bundle/deb/ 2>/dev/null || true
|
||||
echo "Available RPM files:"
|
||||
ls -lt $CARGO_TARGET_DIR/release/bundle/rpm/ 2>/dev/null || true
|
||||
|
||||
# Copy from persistent cache location (get NEWEST file by modification time)
|
||||
APPIMAGE=$(ls -t $CARGO_TARGET_DIR/release/bundle/appimage/*.AppImage 2>/dev/null | head -1)
|
||||
echo "Copying AppImage: $APPIMAGE"
|
||||
cp "$APPIMAGE" src-tauri/target/release/bundle/appimage/Cinny-Linux-x64.AppImage
|
||||
|
||||
DEB=$(ls -t $CARGO_TARGET_DIR/release/bundle/deb/*.deb 2>/dev/null | head -1)
|
||||
echo "Copying DEB: $DEB"
|
||||
cp "$DEB" src-tauri/target/release/bundle/deb/Cinny-Linux-x64.deb
|
||||
|
||||
RPM=$(ls -t $CARGO_TARGET_DIR/release/bundle/rpm/*.rpm 2>/dev/null | head -1)
|
||||
echo "Copying RPM: $RPM"
|
||||
cp "$RPM" src-tauri/target/release/bundle/rpm/Cinny-Linux-x64.rpm
|
||||
|
||||
# Copy signature file for updater if it exists (get NEWEST)
|
||||
if ls $CARGO_TARGET_DIR/release/bundle/appimage/*.AppImage.sig 1> /dev/null 2>&1; then
|
||||
APPSIG=$(ls -t $CARGO_TARGET_DIR/release/bundle/appimage/*.AppImage.sig 2>/dev/null | head -1)
|
||||
echo "Copying AppImage sig: $APPSIG"
|
||||
cp "$APPSIG" src-tauri/target/release/bundle/appimage/Cinny-Linux-x64.AppImage.sig
|
||||
fi
|
||||
|
||||
# List final output
|
||||
echo "Final output:"
|
||||
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: Build Electron app
|
||||
run: npm run build:linux
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- 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: Paarrot-Linux-x64.AppImage
|
||||
path: dist-electron/Paarrot-*-x64.AppImage
|
||||
|
||||
- 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: Paarrot-Linux-x64.deb
|
||||
path: dist-electron/Paarrot-*-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
|
||||
needs: increment-version
|
||||
if: always() && (needs.increment-version.outputs.should_build == 'true' || needs.increment-version.result == 'skipped')
|
||||
env:
|
||||
CARGO_TARGET_DIR: C:\cargo-cache\cinny-desktop-android
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: false
|
||||
ref: ${{ github.ref_name }}
|
||||
clean: false
|
||||
|
||||
- name: Pull latest (after version bump)
|
||||
if: github.ref == 'refs/heads/main'
|
||||
shell: powershell
|
||||
run: git pull origin main
|
||||
|
||||
- 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: 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
|
||||
timeout-minutes: 30
|
||||
run: |
|
||||
$env:PATH = "$env:USERPROFILE\.cargo\bin;$env:PATH"
|
||||
npm run tauri android build -- --ci --target aarch64
|
||||
# Kill any lingering processes that might hang
|
||||
Stop-Process -Name "java" -Force -ErrorAction SilentlyContinue
|
||||
Stop-Process -Name "gradle" -Force -ErrorAction SilentlyContinue
|
||||
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
|
||||
name: Paarrot-Linux-x64.rpm
|
||||
path: dist-electron/Paarrot-*-x64.rpm
|
||||
|
||||
create-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [increment-version, build-windows, build-linux, build-android]
|
||||
needs: [increment-version, build-windows, build-linux]
|
||||
if: always() && (needs.build-windows.result == 'success' || needs.build-linux.result == 'success')
|
||||
|
||||
steps:
|
||||
@@ -453,7 +180,7 @@ jobs:
|
||||
if [ -n "${{ needs.increment-version.outputs.version }}" ]; then
|
||||
VERSION="${{ needs.increment-version.outputs.version }}"
|
||||
else
|
||||
VERSION=$(grep -Po '"version":\s*"\K[^"]+' src-tauri/tauri.conf.json | head -1)
|
||||
VERSION=$(grep -Po '"version":\s*"\K[^"]+' package.json | head -1)
|
||||
fi
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "Version: $VERSION"
|
||||
@@ -483,42 +210,10 @@ jobs:
|
||||
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.sig/Cinny-Windows-x64.msi.sig" ]; then
|
||||
MSI_SIG=$(cat "artifacts/Cinny-Windows-x64.msi.sig/Cinny-Windows-x64.msi.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"
|
||||
}
|
||||
}
|
||||
}
|
||||
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/
|
||||
find artifacts -type f \( -name "*.exe" -o -name "*.AppImage" -o -name "*.deb" -o -name "*.rpm" -o -name "*.dmg" -o -name "*.zip" \) -exec cp {} release-files/ \;
|
||||
ls -la release-files/
|
||||
|
||||
- name: Create or Update Release
|
||||
@@ -569,41 +264,3 @@ jobs:
|
||||
done
|
||||
|
||||
echo "Release complete!"
|
||||
|
||||
# Also update 'latest' release with update.json for auto-updater
|
||||
echo "Updating 'latest' release..."
|
||||
LATEST_TAG="latest"
|
||||
LATEST_ID=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"${API_BASE}/repos/${REPO}/releases/tags/${LATEST_TAG}" | jq -r '.id // empty')
|
||||
|
||||
if [ -z "$LATEST_ID" ]; then
|
||||
echo "Creating 'latest' release..."
|
||||
LATEST_ID=$(curl -s -X POST \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\": \"${LATEST_TAG}\", \"name\": \"Latest Release\", \"body\": \"Always points to the most recent version (${VERSION})\", \"draft\": false, \"prerelease\": false}" \
|
||||
"${API_BASE}/repos/${REPO}/releases" | jq -r '.id')
|
||||
else
|
||||
# Update release body
|
||||
curl -s -X PATCH \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"body\": \"Always points to the most recent version (${VERSION})\"}" \
|
||||
"${API_BASE}/repos/${REPO}/releases/${LATEST_ID}"
|
||||
# Delete existing update.json asset
|
||||
LATEST_ASSETS=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"${API_BASE}/repos/${REPO}/releases/${LATEST_ID}/assets" | jq -r '.[] | select(.name=="update.json") | .id')
|
||||
for ASSET_ID in $LATEST_ASSETS; do
|
||||
curl -s -X DELETE -H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"${API_BASE}/repos/${REPO}/releases/${LATEST_ID}/assets/${ASSET_ID}"
|
||||
done
|
||||
fi
|
||||
|
||||
# Upload update.json to latest
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@release-files/update.json" \
|
||||
"${API_BASE}/repos/${REPO}/releases/${LATEST_ID}/assets?name=update.json"
|
||||
|
||||
echo "Latest release updated!"
|
||||
|
||||
Reference in New Issue
Block a user