Build & Release #47
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Release | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| workflow_dispatch: | |
| inputs: | |
| test_upload_dist: | |
| description: "Test upload-dist.js script" | |
| required: true | |
| default: false | |
| type: boolean | |
| build_os: | |
| description: "Build for specific OS: Windows, macOS, Linux, All" | |
| required: true | |
| default: "All" | |
| type: choice | |
| options: | |
| - Windows | |
| - macOS | |
| - Linux | |
| - All | |
| skip_notarize: | |
| description: "Skip Notarization (true/false)" | |
| required: true | |
| default: false | |
| type: boolean | |
| env: | |
| NODE_VERSION: 22.x | |
| jobs: | |
| # ============== macOS Builds ============== | |
| build-macos: | |
| name: Build macOS (${{ matrix.arch }}) | |
| if: github.event.inputs.build_os == 'macOS' || github.event.inputs.build_os == 'All' || startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: macos-15-intel | |
| arch: x64 | |
| - runner: macos-latest | |
| arch: arm64 | |
| steps: | |
| - name: Check out git repository | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: pnpm | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Clean workspace | |
| run: rm -rf dist dist_electron node_modules ~/.cache/electron-builder ~/.cache/electron | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build macOS App (${{ matrix.arch }}) | |
| run: pnpm run build && electron-builder --config electron-builder.config.ts --mac --${{ matrix.arch }} --publish never | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| CSC_LINK: ${{ secrets.MAC_CSC_LINK }} | |
| CSC_KEY_PASSWORD: ${{ secrets.MAC_CSC_KEY_PASSWORD }} | |
| APPLE_ID: ${{ secrets.APPLE_ID }} | |
| APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} | |
| APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
| SKIP_NOTARIZE: ${{ inputs.skip_notarize }} | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: PicGo-macOS-${{ matrix.arch }} | |
| path: dist/*.* | |
| # ============== Windows Builds ============== | |
| build-windows: | |
| name: Build Windows (${{ matrix.arch }}) | |
| if: github.event.inputs.build_os == 'Windows' || github.event.inputs.build_os == 'All' || startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: windows-latest | |
| arch: x64 | |
| build_arch: --x64 --ia32 | |
| - runner: windows-11-arm | |
| arch: arm64 | |
| build_arch: --arm64 | |
| steps: | |
| - name: Check out git repository | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: pnpm | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Clean workspace | |
| run: | | |
| if (Test-Path dist) { Remove-Item -Recurse -Force dist } | |
| if (Test-Path dist_electron) { Remove-Item -Recurse -Force dist_electron } | |
| if (Test-Path node_modules) { Remove-Item -Recurse -Force node_modules } | |
| if (Test-Path "$env:LOCALAPPDATA\electron-builder") { | |
| Remove-Item "$env:LOCALAPPDATA\electron-builder" -Recurse -Force -ErrorAction SilentlyContinue | |
| } | |
| if (Test-Path "$env:LOCALAPPDATA\electron") { | |
| Remove-Item "$env:LOCALAPPDATA\electron" -Recurse -Force -ErrorAction SilentlyContinue | |
| } | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build Windows App (${{ matrix.arch }}) | |
| run: pnpm run build && electron-builder --config electron-builder.config.ts --win ${{ matrix.build_arch }} --publish never | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: PicGo-Windows-${{ matrix.arch }} | |
| path: dist/*.* | |
| # ============== Linux Builds ============== | |
| build-linux: | |
| name: Build Linux (${{ matrix.arch }}) | |
| if: github.event.inputs.build_os == 'Linux' || github.event.inputs.build_os == 'All' || startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: ubuntu-latest | |
| arch: x64 | |
| - runner: ubuntu-24.04-arm | |
| arch: arm64 | |
| steps: | |
| - name: Check out git repository | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: pnpm | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Clean workspace | |
| run: rm -rf dist dist_electron node_modules ~/.cache/electron-builder ~/.cache/electron | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libfuse2 | |
| - name: Build Linux App (${{ matrix.arch }}) | |
| run: pnpm run build && electron-builder --config electron-builder.config.ts --linux --${{ matrix.arch }} --publish never | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: PicGo-Linux-${{ matrix.arch }} | |
| path: dist/*.* | |
| # ============== Release ============== | |
| release: | |
| name: Merge & Release | |
| needs: [build-macos, build-windows, build-linux] | |
| if: always() && (needs.build-macos.result == 'success' || needs.build-windows.result == 'success' || needs.build-linux.result == 'success') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check out git repository | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: pnpm | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: List artifacts | |
| run: ls -laR artifacts/ | |
| - name: Merge artifacts and yml files | |
| run: node scripts/merge-artifacts.js | |
| - name: List dist | |
| run: ls -la dist/ | |
| - name: Upload to release.picgo.app | |
| if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.test_upload_dist | |
| run: node scripts/upload-dist.js --all | |
| env: | |
| PICGO_ENV_S3_SECRET_ID: ${{ secrets.PICGO_ENV_S3_SECRET_ID }} | |
| PICGO_ENV_S3_SECRET_KEY: ${{ secrets.PICGO_ENV_S3_SECRET_KEY }} | |
| PICGO_ENV_S3_ACCOUNT_ID: ${{ secrets.PICGO_ENV_S3_ACCOUNT_ID }} | |
| PICGO_ENV_S3_LEGACY_ACCOUNT_ID: ${{ secrets.PICGO_ENV_S3_LEGACY_ACCOUNT_ID }} | |
| PICGO_ENV_S3_LEGACY_SECRET_ID: ${{ secrets.PICGO_ENV_S3_LEGACY_SECRET_ID }} | |
| PICGO_ENV_S3_LEGACY_SECRET_KEY: ${{ secrets.PICGO_ENV_S3_LEGACY_SECRET_KEY }} | |
| - name: Publish GitHub Dev Release | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: softprops/action-gh-release@v2 | |
| continue-on-error: true | |
| with: | |
| token: ${{ secrets.GH_TOKEN }} | |
| tag_name: dev | |
| draft: true | |
| prerelease: false | |
| files: | | |
| dist/*.exe | |
| dist/*.dmg | |
| dist/*.zip | |
| dist/*.AppImage | |
| dist/*.deb | |
| dist/*.snap | |
| dist/*.tar.gz | |
| dist/*.yml | |
| dist/*.blockmap | |
| - name: Publish GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v2 | |
| continue-on-error: true | |
| with: | |
| token: ${{ secrets.GH_TOKEN }} | |
| generate_release_notes: true | |
| draft: true | |
| prerelease: false | |
| files: | | |
| dist/*.exe | |
| dist/*.dmg | |
| dist/*.zip | |
| dist/*.AppImage | |
| dist/*.deb | |
| dist/*.snap | |
| dist/*.tar.gz | |
| dist/*.yml | |
| dist/*.blockmap |