diff --git a/.gitea/workflows/deploy-web-apps.yml b/.gitea/workflows/deploy-web-apps.yml index cc0bac1..c478def 100644 --- a/.gitea/workflows/deploy-web-apps.yml +++ b/.gitea/workflows/deploy-web-apps.yml @@ -17,6 +17,13 @@ jobs: - name: Checkout uses: https://github.com/actions/checkout@v4 + - name: Restore npm cache + uses: https://github.com/actions/cache@v4 + with: + path: ~/AppData/Local/npm-cache + key: npm-windows-${{ hashFiles('package-lock.json', 'website/package-lock.json') }} + restore-keys: npm-windows- + - name: Install root dependencies env: NODE_ENV: development diff --git a/.gitea/workflows/release-draft.yml b/.gitea/workflows/release-draft.yml index adebc2a..8c6d144 100644 --- a/.gitea/workflows/release-draft.yml +++ b/.gitea/workflows/release-draft.yml @@ -48,18 +48,30 @@ jobs: - name: Checkout uses: https://github.com/actions/checkout@v4 + - name: Restore npm cache + uses: https://github.com/actions/cache@v4 + with: + path: /root/.npm + key: npm-linux-${{ hashFiles('package-lock.json', 'server/package-lock.json') }} + restore-keys: npm-linux- + + - name: Restore Electron cache + uses: https://github.com/actions/cache@v4 + with: + path: | + /root/.cache/electron + /root/.cache/electron-builder + key: electron-linux-${{ hashFiles('package.json') }} + restore-keys: electron-linux- + - name: Install dependencies env: NODE_ENV: development run: | + apt-get update && apt-get install -y --no-install-recommends zip npm ci cd server && npm ci - - name: Install zip utility - run: | - apt-get update - apt-get install -y zip - - name: Set CI release version run: > node tools/set-release-version.js @@ -108,6 +120,22 @@ jobs: - name: Checkout uses: https://github.com/actions/checkout@v4 + - name: Restore npm cache + uses: https://github.com/actions/cache@v4 + with: + path: ~/AppData/Local/npm-cache + key: npm-windows-${{ hashFiles('package-lock.json', 'server/package-lock.json') }} + restore-keys: npm-windows- + + - name: Restore Electron cache + uses: https://github.com/actions/cache@v4 + with: + path: | + ~/AppData/Local/electron/Cache + ~/AppData/Local/electron-builder/Cache + key: electron-windows-${{ hashFiles('package.json') }} + restore-keys: electron-windows- + - name: Install dependencies env: NODE_ENV: development @@ -136,8 +164,6 @@ jobs: run: | $projectRoot = $PWD.ProviderPath $electronBuilderWorkspace = Join-Path $env:TEMP ([guid]::NewGuid().ToString('N')) - $electronBuilderCache = Join-Path $electronBuilderWorkspace 'electron-builder-cache' - $electronCache = Join-Path $electronBuilderWorkspace 'electron-cache' $locationPushed = $false function Invoke-RoboCopy { @@ -157,21 +183,27 @@ jobs: # electron-builder rejects junction-backed files during asar creation # because their resolved path sits outside the package root. New-Item -ItemType Directory -Path $electronBuilderWorkspace | Out-Null - New-Item -ItemType Directory -Path $electronBuilderCache | Out-Null - New-Item -ItemType Directory -Path $electronCache | Out-Null - $env:ELECTRON_BUILDER_CACHE = $electronBuilderCache - $env:ELECTRON_CACHE = $electronCache + + # Point electron-builder at the Electron binary already present + # in the main workspace so the packaging workspace can skip it. + $env:ELECTRON_OVERRIDE_DIST_PATH = Join-Path $projectRoot 'node_modules\electron\dist' try { Copy-Item -Path (Join-Path $projectRoot 'package.json') -Destination (Join-Path $electronBuilderWorkspace 'package.json') -Force Copy-Item -Path (Join-Path $projectRoot 'package-lock.json') -Destination (Join-Path $electronBuilderWorkspace 'package-lock.json') -Force Invoke-RoboCopy (Join-Path $projectRoot 'dist') (Join-Path $electronBuilderWorkspace 'dist') Invoke-RoboCopy (Join-Path $projectRoot 'images') (Join-Path $electronBuilderWorkspace 'images') - Invoke-RoboCopy (Join-Path $projectRoot 'node_modules') (Join-Path $electronBuilderWorkspace 'node_modules') Push-Location $electronBuilderWorkspace $locationPushed = $true - npx electron-builder --win --publish never + + # Install only production dependencies — much faster than + # mirroring the full node_modules tree via robocopy and also + # avoids the junction/symlink issues that require the temp workspace. + npm ci --omit=dev --ignore-scripts + + $electronBuilderBin = Join-Path $projectRoot 'node_modules\.bin\electron-builder.cmd' + & $electronBuilderBin --win --publish never if ($LASTEXITCODE -ne 0) { throw "electron-builder failed with exit code $LASTEXITCODE" } @@ -217,9 +249,6 @@ jobs: - name: Checkout uses: https://github.com/actions/checkout@v4 - - name: Install dependencies - run: npm ci --omit=dev - - name: Download previous manifest env: GITEA_RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}