Optimize CI build: npm/electron caches, merged prepare job, wine64-only, store compression
Build / prepare (push) Successful in 15s
Build / build-windows (push) Failing after 5m9s
Build / finalize-release (push) Canceled after 0s
Build / build-linux (push) Canceled after 10m24s

- Cache ~/.npm (setup-node) and ~/.cache/electron{,-builder} between runs
- Merge increment-version + prepare-release into one job; build jobs check out
  the bumped commit directly instead of pulling
- Install wine64 only (drop i386 arch + wine32)
- Shallow checkouts in build jobs; drop no-op clean step
- Fix GITHUB_TOKEN/GITEA_TOKEN mixup in finalize-release tag cleanup
- NSIS compression: store (faster, larger exe)
- Bump cinny submodule: sourcemap skipped in CI
This commit is contained in:
litruv committed 2026-10-06 08:04:19 +11:00
1 parent cb4445f812
commit 7821c23878
3 files changed
+87 -103

No files matched your search

+85 -101
View File
@@ -12,12 +12,14 @@ on:
# Build jobs publish assets straight to Gitea/GitHub releases via the REST API. # Build jobs publish assets straight to Gitea/GitHub releases via the REST API.
jobs: jobs:
increment-version: prepare:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
version: ${{ steps.finalize.outputs.VERSION }} version: ${{ steps.finalize.outputs.VERSION }}
tag: ${{ steps.finalize.outputs.TAG_NAME }}
commit_sha: ${{ steps.finalize.outputs.COMMIT_SHA }}
should_build: ${{ steps.decide.outputs.SHOULD_BUILD }} should_build: ${{ steps.decide.outputs.SHOULD_BUILD }}
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -49,15 +51,15 @@ jobs:
echo "Current version: $CURRENT" echo "Current version: $CURRENT"
echo "Should bump: $SHOULD_BUMP" echo "Should bump: $SHOULD_BUMP"
echo "Should build: $SHOULD_BUILD" echo "Should build: $SHOULD_BUILD"
- name: Bump patch version - name: Bump patch version
id: bump id: bump
if: ${{ steps.decide.outputs.SHOULD_BUMP == 'true' }} if: steps.decide.outputs.SHOULD_BUILD == 'true' && steps.decide.outputs.SHOULD_BUMP == 'true'
run: | run: |
# Get current version from package.json # Get current version from package.json
CURRENT=$(grep -Po '"version":\s*"\K[^"]+' package.json | head -1) CURRENT=$(grep -Po '"version":\s*"\K[^"]+' package.json | head -1)
echo "Current version: $CURRENT" echo "Current version: $CURRENT"
# Split and increment patch # Split and increment patch
MAJOR=$(echo $CURRENT | cut -d. -f1) MAJOR=$(echo $CURRENT | cut -d. -f1)
MINOR=$(echo $CURRENT | cut -d. -f2) MINOR=$(echo $CURRENT | cut -d. -f2)
@@ -65,17 +67,17 @@ jobs:
NEW_PATCH=$((PATCH + 1)) NEW_PATCH=$((PATCH + 1))
NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}" NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}"
echo "New version: $NEW_VERSION" echo "New version: $NEW_VERSION"
# Update package.json # Update package.json
sed -i "s/\"version\": \"${CURRENT}\"/\"version\": \"${NEW_VERSION}\"/" package.json sed -i "s/\"version\": \"${CURRENT}\"/\"version\": \"${NEW_VERSION}\"/" package.json
# Verify the change # Verify the change
grep '"version"' package.json | head -1 grep '"version"' package.json | head -1
echo "VERSION=$NEW_VERSION" >> $GITHUB_OUTPUT echo "VERSION=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Commit and push version bump - name: Commit and push version bump
if: ${{ steps.decide.outputs.SHOULD_BUMP == 'true' }} if: steps.decide.outputs.SHOULD_BUILD == 'true' && steps.decide.outputs.SHOULD_BUMP == 'true'
run: | run: |
git config user.name "GitHub Actions" git config user.name "GitHub Actions"
git config user.email "actions@github.com" git config user.email "actions@github.com"
@@ -99,50 +101,24 @@ jobs:
echo "Failed to push version bump after 3 attempts" echo "Failed to push version bump after 3 attempts"
exit 1 exit 1
- name: Finalize version output - name: Resolve version and commit
id: finalize id: finalize
if: steps.decide.outputs.SHOULD_BUILD == 'true'
run: | run: |
if [ -n "${{ steps.bump.outputs.VERSION }}" ]; then if [ -n "${{ steps.bump.outputs.VERSION }}" ]; then
echo "VERSION=${{ steps.bump.outputs.VERSION }}" >> $GITHUB_OUTPUT VERSION="${{ steps.bump.outputs.VERSION }}"
else
echo "VERSION=${{ steps.decide.outputs.CURRENT_VERSION }}" >> $GITHUB_OUTPUT
fi
prepare-release:
runs-on: ubuntu-latest
needs: increment-version
if: always() && needs.increment-version.outputs.should_build == 'true'
outputs:
version: ${{ steps.version.outputs.VERSION }}
tag: ${{ steps.version.outputs.TAG_NAME }}
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
- name: Resolve version
id: version
run: |
if [ -n "${{ needs.increment-version.outputs.version }}" ]; then
VERSION="${{ needs.increment-version.outputs.version }}"
else else
VERSION=$(grep -Po '"version":\s*"\K[^"]+' package.json | head -1) VERSION=$(grep -Po '"version":\s*"\K[^"]+' package.json | head -1)
fi fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "TAG_NAME=v$VERSION" >> $GITHUB_OUTPUT echo "TAG_NAME=v$VERSION" >> $GITHUB_OUTPUT
echo "COMMIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "Version: $VERSION" echo "Version: $VERSION"
- name: Create and push tag - name: Create and push tag
if: steps.decide.outputs.SHOULD_BUILD == 'true'
run: | run: |
VERSION="${{ steps.version.outputs.VERSION }}" TAG_NAME="${{ steps.finalize.outputs.TAG_NAME }}"
TAG_NAME="v${VERSION}"
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
echo "Tag $TAG_NAME already exists" echo "Tag $TAG_NAME already exists"
else else
@@ -151,14 +127,15 @@ jobs:
git tag -a "$TAG_NAME" -m "Release $TAG_NAME" git tag -a "$TAG_NAME" -m "Release $TAG_NAME"
git push origin "$TAG_NAME" git push origin "$TAG_NAME"
fi fi
- name: Ensure Gitea release - name: Ensure Gitea release
if: steps.decide.outputs.SHOULD_BUILD == 'true'
env: env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
set -euo pipefail set -euo pipefail
VERSION="${{ steps.version.outputs.VERSION }}" VERSION="${{ steps.finalize.outputs.VERSION }}"
TAG_NAME="v${VERSION}" TAG_NAME="${{ steps.finalize.outputs.TAG_NAME }}"
API_BASE="${{ github.server_url }}/api/v1" API_BASE="${{ github.server_url }}/api/v1"
REPO="${{ github.repository }}" REPO="${{ github.repository }}"
@@ -175,14 +152,15 @@ jobs:
fi fi
echo "Gitea release id: ${RELEASE_ID}" echo "Gitea release id: ${RELEASE_ID}"
- name: Ensure GitHub release - name: Ensure GitHub release
if: steps.decide.outputs.SHOULD_BUILD == 'true'
env: env:
GH_TOKEN: ${{ secrets.GHTOKEN }} GH_TOKEN: ${{ secrets.GHTOKEN }}
run: | run: |
set -euo pipefail set -euo pipefail
VERSION="${{ steps.version.outputs.VERSION }}" VERSION="${{ steps.finalize.outputs.VERSION }}"
TAG_NAME="v${VERSION}" TAG_NAME="${{ steps.finalize.outputs.TAG_NAME }}"
GITHUB_REPO="Paarrot/Paarrot-Desktop" GITHUB_REPO="Paarrot/Paarrot-Desktop"
RELEASE_ID=$(curl -fsS -H "Authorization: token ${GH_TOKEN}" \ RELEASE_ID=$(curl -fsS -H "Authorization: token ${GH_TOKEN}" \
@@ -201,15 +179,16 @@ jobs:
build-windows: build-windows:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [increment-version, prepare-release] needs: prepare
if: always() && needs.prepare-release.result == 'success' if: always() && needs.prepare.result == 'success' && needs.prepare.outputs.should_build == 'true'
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
submodules: false submodules: false
ref: ${{ github.ref_name }} fetch-depth: 1
ref: ${{ needs.prepare.outputs.commit_sha }}
- name: Checkout submodules manually - name: Checkout submodules manually
run: | run: |
@@ -238,27 +217,31 @@ jobs:
echo "Resolved submodule commit:" echo "Resolved submodule commit:"
git -C cinny rev-parse HEAD git -C cinny rev-parse HEAD
- name: Pull latest (after version bump)
if: github.ref == 'refs/heads/main'
run: git pull origin main
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: '20' node-version: '20'
cache: 'npm'
cache-dependency-path: |
package-lock.json
cinny/package-lock.json
- name: Cache Electron downloads
uses: actions/cache@v4
with:
path: |
~/.cache/electron
~/.cache/electron-builder
key: electron-${{ hashFiles('package-lock.json') }}
restore-keys: electron-
- name: Install Wine (NSIS cross-build) - name: Install Wine (NSIS cross-build)
run: | run: |
set -euo pipefail set -euo pipefail
# electron-builder spawns `wine` by name; wine64 alone is not enough. # electron-builder spawns `wine` by name; wine64 alone is enough, wine32
sudo dpkg --add-architecture i386 # only adds a slow i386 package index for no benefit here.
sudo apt-get update sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends wine64
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
wine \
wine64 \
wine32 \
|| sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends wine64
if ! command -v wine >/dev/null 2>&1; then if ! command -v wine >/dev/null 2>&1; then
WINE64_BIN=$(command -v wine64) WINE64_BIN=$(command -v wine64)
@@ -268,31 +251,27 @@ jobs:
command -v wine command -v wine
wine --version wine --version
- name: Install dependencies (root) - name: Install dependencies (root)
run: npm ci --prefer-offline run: npm ci --prefer-offline
- name: Install dependencies (cinny) - name: Install dependencies (cinny)
working-directory: ./cinny working-directory: ./cinny
run: npm ci --prefer-offline run: npm ci --prefer-offline
- name: Clean previous builds
run: |
rm -rf cinny/dist dist-electron
- name: Build Electron app - name: Build Electron app
run: npm run build:local -- --win run: npm run build:local -- --win
env: env:
GH_TOKEN: ${{ secrets.GHTOKEN }} GH_TOKEN: ${{ secrets.GHTOKEN }}
CSC_IDENTITY_AUTO_DISCOVERY: 'false' CSC_IDENTITY_AUTO_DISCOVERY: 'false'
- name: Upload Windows assets to releases - name: Upload Windows assets to releases
env: env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GHTOKEN }} GH_TOKEN: ${{ secrets.GHTOKEN }}
run: | run: |
set -euo pipefail set -euo pipefail
TAG_NAME="${{ needs.prepare-release.outputs.tag }}" TAG_NAME="${{ needs.prepare.outputs.tag }}"
API_BASE="${{ github.server_url }}/api/v1" API_BASE="${{ github.server_url }}/api/v1"
REPO="${{ github.repository }}" REPO="${{ github.repository }}"
GITHUB_REPO="Paarrot/Paarrot-Desktop" GITHUB_REPO="Paarrot/Paarrot-Desktop"
@@ -349,22 +328,23 @@ jobs:
for FILE in dist-electron/Paarrot-*-win-x64.exe dist-electron/latest.yml; do for FILE in dist-electron/Paarrot-*-win-x64.exe dist-electron/latest.yml; do
upload_one "$FILE" upload_one "$FILE"
done done
- name: List build output - name: List build output
run: | run: |
find dist-electron -type f -printf '%p\n' | sort find dist-electron -type f -printf '%p\n' | sort
build-linux: build-linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [increment-version, prepare-release] needs: prepare
if: always() && needs.prepare-release.result == 'success' if: always() && needs.prepare.result == 'success' && needs.prepare.outputs.should_build == 'true'
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
submodules: false submodules: false
ref: ${{ github.ref_name }} fetch-depth: 1
ref: ${{ needs.prepare.outputs.commit_sha }}
- name: Checkout submodules manually - name: Checkout submodules manually
run: | run: |
@@ -393,40 +373,44 @@ jobs:
echo "Resolved submodule commit:" echo "Resolved submodule commit:"
git -C cinny rev-parse HEAD git -C cinny rev-parse HEAD
- name: Pull latest (after version bump)
if: github.ref == 'refs/heads/main'
run: git pull origin main
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: '20' node-version: '20'
cache: 'npm'
cache-dependency-path: |
package-lock.json
cinny/package-lock.json
- name: Cache Electron downloads
uses: actions/cache@v4
with:
path: |
~/.cache/electron
~/.cache/electron-builder
key: electron-${{ hashFiles('package-lock.json') }}
restore-keys: electron-
- name: Install dependencies (root) - name: Install dependencies (root)
run: npm ci --prefer-offline run: npm ci --prefer-offline
- name: Install dependencies (cinny) - name: Install dependencies (cinny)
working-directory: ./cinny working-directory: ./cinny
run: npm ci --prefer-offline run: npm ci --prefer-offline
- name: Clean previous builds
run: |
rm -rf cinny/dist dist-electron
- name: Build Electron app - name: Build Electron app
run: npm run build:local -- --linux run: npm run build:local -- --linux
env: env:
GH_TOKEN: ${{ secrets.GHTOKEN }} GH_TOKEN: ${{ secrets.GHTOKEN }}
- name: Upload Linux assets to releases - name: Upload Linux assets to releases
env: env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GHTOKEN }} GH_TOKEN: ${{ secrets.GHTOKEN }}
run: | run: |
set -euo pipefail set -euo pipefail
VERSION="${{ needs.prepare-release.outputs.version }}" TAG_NAME="${{ needs.prepare.outputs.tag }}"
TAG_NAME="${{ needs.prepare-release.outputs.tag }}"
API_BASE="${{ github.server_url }}/api/v1" API_BASE="${{ github.server_url }}/api/v1"
REPO="${{ github.repository }}" REPO="${{ github.repository }}"
GITHUB_REPO="Paarrot/Paarrot-Desktop" GITHUB_REPO="Paarrot/Paarrot-Desktop"
@@ -486,16 +470,16 @@ jobs:
finalize-release: finalize-release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [increment-version, prepare-release, build-windows, build-linux] needs: [prepare, build-windows, build-linux]
if: always() && needs.prepare-release.result == 'success' && (needs.build-windows.result == 'success' || needs.build-linux.result == 'success') if: always() && needs.prepare.result == 'success' && needs.prepare.outputs.should_build == 'true' && (needs.build-windows.result == 'success' || needs.build-linux.result == 'success')
steps: steps:
- name: Cleanup old Gitea releases - name: Cleanup old Gitea releases
env: env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
set -euo pipefail set -euo pipefail
TAG_NAME="${{ needs.prepare-release.outputs.tag }}" TAG_NAME="${{ needs.prepare.outputs.tag }}"
API_BASE="${{ github.server_url }}/api/v1" API_BASE="${{ github.server_url }}/api/v1"
REPO="${{ github.repository }}" REPO="${{ github.repository }}"
@@ -515,13 +499,13 @@ jobs:
"${API_BASE}/repos/${REPO}/tags/${OLD_TAG}" >/dev/null || true "${API_BASE}/repos/${REPO}/tags/${OLD_TAG}" >/dev/null || true
fi fi
done done
- name: Cleanup old GitHub releases - name: Cleanup old GitHub releases
env: env:
GH_TOKEN: ${{ secrets.GHTOKEN }} GH_TOKEN: ${{ secrets.GHTOKEN }}
run: | run: |
set -euo pipefail set -euo pipefail
TAG_NAME="${{ needs.prepare-release.outputs.tag }}" TAG_NAME="${{ needs.prepare.outputs.tag }}"
GITHUB_REPO="Paarrot/Paarrot-Desktop" GITHUB_REPO="Paarrot/Paarrot-Desktop"
echo "Cleaning up old GitHub releases (keeping ${TAG_NAME})..." echo "Cleaning up old GitHub releases (keeping ${TAG_NAME})..."
+1 -1
Submodule cinny updated: 72c71bc789...fabbbc40af.
+1 -1
View File
@@ -102,7 +102,7 @@
"shortcutName": "Paarrot", "shortcutName": "Paarrot",
"differentialPackage": false "differentialPackage": false
}, },
"compression": "normal", "compression": "store",
"publish": [ "publish": [
{ {
"provider": "github", "provider": "github",