diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 28b4ff62..c8a40462 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,9 +6,6 @@ name: Auto Build # Workflow's trigger on: workflow_dispatch: - push: - branches: - - release env: ELECTRON_OUTPUT_PATH: ./dist_electron @@ -17,7 +14,7 @@ env: jobs: release: - name: build and release electron app + name: Build runs-on: ${{ matrix.os }} @@ -33,7 +30,7 @@ jobs: git config --global core.autocrlf false - name: Check out git repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 # step2: sign - name: Install the Apple certificates diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 8e354b33..da0d23f3 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-13, windows-latest] + os: [ubuntu-latest, macos-13, windows-latest, windows-11-arm] steps: - name: Set up git config @@ -49,11 +49,17 @@ jobs: yarn install npm rebuild --platform=darwin --arch=arm64 sharp - - name: Install dependencies (Windows) + - name: Install dependencies (Windows x64) if: matrix.os == 'windows-latest' run: | yarn config set ignore-engines true yarn install + + - name: Install dependencies (Windows ARM64) + if: matrix.os == 'windows-11-arm' + run: | + yarn config set ignore-engines true + yarn install - name: Install dependencies (Linux) if: matrix.os == 'ubuntu-latest' @@ -61,8 +67,32 @@ jobs: yarn config set ignore-engines true yarn install - - name: Build application (Windows) + - name: Modify electron-builder.json for Windows x64 if: matrix.os == 'windows-latest' + run: | + # Remove arm64 from the arch array, keep only x64 + $config = Get-Content electron-builder.json | ConvertFrom-Json + $config.win.target[0].arch = @("x64") + $config | ConvertTo-Json -Depth 10 | Set-Content electron-builder.json + + - name: Modify electron-builder.json for Windows ARM64 + if: matrix.os == 'windows-11-arm' + run: | + # Remove x64 from the arch array, keep only arm64 + $config = Get-Content electron-builder.json | ConvertFrom-Json + $config.win.target[0].arch = @("arm64") + $config | ConvertTo-Json -Depth 10 | Set-Content electron-builder.json + + - name: Build application (Windows x64) + if: matrix.os == 'windows-latest' + run: yarn build:win + env: + ELECTRON_SKIP_NOTARIZATION: true + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + + - name: Build application (Windows ARM64) + if: matrix.os == 'windows-11-arm' run: yarn build:win env: ELECTRON_SKIP_NOTARIZATION: true @@ -85,14 +115,23 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GH_TOKEN }} - - name: Upload Windows executables with original names + - name: Upload Windows x64 executables if: matrix.os == 'windows-latest' uses: actions/upload-artifact@v4 with: - name: windows-executables + name: windows-x64-executables + path: | + dist_electron/PicList-Setup-*.exe + retention-days: 30 + if-no-files-found: error + + - name: Upload Windows ARM64 executables + if: matrix.os == 'windows-11-arm' + uses: actions/upload-artifact@v4 + with: + name: windows-arm64-executables path: | dist_electron/PicList-Setup-*.exe - dist_electron/*.exe.blockmap retention-days: 30 if-no-files-found: error @@ -103,9 +142,6 @@ jobs: name: macos-packages path: | dist_electron/PicList-*.dmg - dist_electron/PicList-*.zip - dist_electron/*.dmg.blockmap - dist_electron/*.zip.blockmap retention-days: 30 if-no-files-found: error @@ -116,9 +152,6 @@ jobs: name: linux-packages path: | dist_electron/PicList-*.AppImage - dist_electron/PicList-*.snap - dist_electron/PicList-*.deb - dist_electron/PicList-*.rpm - dist_electron/PicList-*.tar.gz + dist_electron/*.snap retention-days: 30 if-no-files-found: ignore diff --git a/electron-builder.json b/electron-builder.json index aff847cd..6f40476a 100644 --- a/electron-builder.json +++ b/electron-builder.json @@ -6,6 +6,7 @@ "output": "dist_electron", "buildResources": "build" }, + "asarUnpack": ["**/node_modules/sharp/**", "**/node_modules/ssh2-no-cpu-features/**", "**/node_modules/@img/**"], "files": ["out/**/*", "dist/**/*", "resources/**/*", "package.json"], "extraResources": [ { @@ -66,7 +67,7 @@ "target": [ { "target": "nsis", - "arch": ["x64", "ia32"] + "arch": ["x64", "arm64"] } ] }, @@ -78,7 +79,7 @@ }, "linux": { "icon": "resources/", - "asarUnpack": ["**/node_modules/sharp/**", "**/node_modules/ssh2-no-cpu-features/**"] + "asarUnpack": ["**/node_modules/sharp/**", "**/node_modules/ssh2-no-cpu-features/**", "**/node_modules/@img/**"] }, "snap": { "publish": ["github"]