ci: remove QEMU VM workflow, add Android APK build job
Some checks failed
Build / increment-version (push) Successful in 7s
Build / build-linux (push) Failing after 30s
Build / build-windows (push) Has been cancelled
Build / build-android (push) Has been cancelled
Build / create-release (push) Has been cancelled

This commit is contained in:
2026-04-07 15:23:06 +10:00
parent beadaff0d5
commit b5c6287442
2 changed files with 96 additions and 439 deletions

View File

@@ -3,7 +3,7 @@ name: Build
on:
push:
branches:
- main
- master
- dev
tags:
- 'v*'
@@ -11,42 +11,34 @@ on:
jobs:
increment-version:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[skip ci]')
if: github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, '[skip ci]')
outputs:
version: ${{ steps.bump.outputs.VERSION }}
should_build: ${{ steps.bump.outputs.SHOULD_BUILD }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Bump patch version
id: bump
run: |
# Get current version from package.json
CURRENT=$(grep -Po '"version":\s*"\K[^"]+' package.json | head -1)
echo "Current version: $CURRENT"
# Split and increment patch
MAJOR=$(echo $CURRENT | cut -d. -f1)
MINOR=$(echo $CURRENT | cut -d. -f2)
PATCH=$(echo $CURRENT | cut -d. -f3)
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}"
echo "New version: $NEW_VERSION"
# Update package.json
sed -i "s/\"version\": \"${CURRENT}\"/\"version\": \"${NEW_VERSION}\"/" package.json
# Verify the change
grep '"version"' package.json | head -1
echo "VERSION=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "SHOULD_BUILD=true" >> $GITHUB_OUTPUT
- name: Commit and push version bump
run: |
git config user.name "GitHub Actions"
@@ -59,74 +51,68 @@ jobs:
runs-on: windows
needs: increment-version
if: always() && (needs.increment-version.outputs.should_build == 'true' || needs.increment-version.result == 'skipped')
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.ref_name }}
- name: Checkout submodules manually
shell: powershell
run: |
git submodule update --init --recursive
run: git submodule update --init --recursive
- name: Pull latest (after version bump)
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/master'
shell: powershell
run: git pull origin main
run: git pull origin master
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies (root)
run: npm install --prefer-offline
- name: Install dependencies (cinny)
working-directory: ./cinny
run: npm install --prefer-offline
- name: Clean previous builds
shell: powershell
run: |
if (Test-Path cinny/dist) { Remove-Item -Recurse -Force cinny/dist }
if (Test-Path dist-electron) { Remove-Item -Recurse -Force dist-electron }
- name: Build Electron app
run: npm run build:win
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Squirrel Setup (x64)
uses: actions/upload-artifact@v3
with:
name: Paarrot-Setup-x64.exe
path: dist-electron/squirrel-windows/Paarrot-*-win-x64.exe
- name: List build output
shell: powershell
run: |
Get-ChildItem -Path dist-electron -Recurse | Select-Object FullName
- name: Copy RELEASES file for upload
shell: powershell
run: |
if (Test-Path "dist-electron/squirrel-windows/RELEASES") {
Copy-Item "dist-electron/squirrel-windows/RELEASES" -Destination "dist-electron/RELEASES"
} else {
Write-Error "RELEASES file not found for x64"
Write-Error "RELEASES file not found"
exit 1
}
- name: Upload Squirrel RELEASES
uses: actions/upload-artifact@v3
with:
name: RELEASES
path: dist-electron/RELEASES
- name: Upload Squirrel nupkg (x64)
uses: actions/upload-artifact@v3
with:
@@ -137,65 +123,108 @@ jobs:
runs-on: ubuntu-latest
needs: increment-version
if: always() && (needs.increment-version.outputs.should_build == 'true' || needs.increment-version.result == 'skipped')
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ github.ref_name }}
- name: Pull latest (after version bump)
if: github.ref == 'refs/heads/main'
run: git pull origin main
if: github.ref == 'refs/heads/master'
run: git pull origin master
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies (root)
run: npm ci --prefer-offline
- name: Install dependencies (cinny)
working-directory: ./cinny
run: npm ci --prefer-offline
- name: Clean previous builds
run: |
rm -rf cinny/dist dist-electron
run: rm -rf cinny/dist dist-electron
- 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: Paarrot-Linux-x64.AppImage
path: dist-electron/Paarrot-*.AppImage
build-android:
runs-on: windows
needs: increment-version
if: always() && (needs.increment-version.outputs.should_build == 'true' || needs.increment-version.result == 'skipped')
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.ref_name }}
- name: Checkout submodules manually
shell: powershell
run: git submodule update --init --recursive
- name: Pull latest (after version bump)
if: github.ref == 'refs/heads/master'
shell: powershell
run: git pull origin master
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies (root)
run: npm install --prefer-offline
- name: Clean previous cinny dist
shell: powershell
run: |
if (Test-Path cinny/dist) { Remove-Item -Recurse -Force cinny/dist }
- name: Apply overlay and build Android APK
run: npm run android:apk
env:
ANDROID_HOME: ${{ secrets.ANDROID_HOME }}
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: Paarrot-Android-debug.apk
path: android/app/build/outputs/apk/debug/app-debug.apk
create-release:
runs-on: ubuntu-latest
needs: [increment-version, build-windows, build-linux]
if: always() && (needs.build-windows.result == 'success' || needs.build-linux.result == 'success')
needs: [increment-version, build-windows, build-linux, build-android]
if: always() && (needs.build-windows.result == 'success' || needs.build-linux.result == 'success' || needs.build-android.result == 'success')
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref_name }}
- name: Pull latest (after version bump)
if: github.ref == 'refs/heads/main'
run: git pull origin main
if: github.ref == 'refs/heads/master'
run: git pull origin master
- name: Get version
id: version
run: |
# Use version from increment-version job if available, otherwise read from file
if [ -n "${{ needs.increment-version.outputs.version }}" ]; then
VERSION="${{ needs.increment-version.outputs.version }}"
else
@@ -203,19 +232,17 @@ jobs:
fi
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: |
@@ -223,18 +250,18 @@ jobs:
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: Prepare release files
run: |
mkdir -p release-files
find artifacts -type f \( -name "*.exe" -o -name "*.AppImage" -o -name "*.nupkg" -o -name "RELEASES*" \) -exec cp {} release-files/ \;
find artifacts -type f \( -name "*.exe" -o -name "*.AppImage" -o -name "*.nupkg" -o -name "*.apk" -o -name "RELEASES*" \) -exec cp {} release-files/ \;
ls -la release-files/
- name: Create or Update Release
env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -242,12 +269,11 @@ jobs:
VERSION="${{ steps.version.outputs.VERSION }}"
TAG_NAME="v${VERSION}"
API_BASE="http://synbox.ruv.wtf:8418/api/v1"
REPO="litruv/cinny-desktop"
# Check if release exists
REPO="litruv/cinny-mobile"
RELEASE_ID=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" \
"${API_BASE}/repos/${REPO}/releases/tags/${TAG_NAME}" | jq -r '.id // empty')
if [ -z "$RELEASE_ID" ]; then
echo "Creating new release for ${TAG_NAME}..."
RELEASE_ID=$(curl -s -X POST \
@@ -257,19 +283,15 @@ jobs:
"${API_BASE}/repos/${REPO}/releases" | jq -r '.id')
echo "Created release with ID: ${RELEASE_ID}"
else
echo "Release exists with ID: ${RELEASE_ID}"
# Delete existing assets
echo "Deleting existing assets..."
echo "Release exists with ID: ${RELEASE_ID}, deleting existing assets..."
ASSETS=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" \
"${API_BASE}/repos/${REPO}/releases/${RELEASE_ID}/assets" | jq -r '.[].id')
for ASSET_ID in $ASSETS; do
echo "Deleting asset ${ASSET_ID}..."
curl -s -X DELETE -H "Authorization: token ${GITEA_TOKEN}" \
"${API_BASE}/repos/${REPO}/releases/${RELEASE_ID}/assets/${ASSET_ID}"
done
fi
# Upload new assets
echo "Uploading assets..."
for FILE in release-files/*; do
FILENAME=$(basename "$FILE")
@@ -281,5 +303,5 @@ jobs:
"${API_BASE}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${FILENAME}"
echo ""
done
echo "Release complete!"