|
| 1 | +name: Build with architecture |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + publish_enabled: |
| 7 | + description: 'Publish artifacts after build?' |
| 8 | + required: true |
| 9 | + type: choice |
| 10 | + options: |
| 11 | + - 'true' |
| 12 | + - 'false' |
| 13 | + default: 'false' |
| 14 | + build_os: |
| 15 | + description: "Build OS" |
| 16 | + required: true |
| 17 | + default: "All" |
| 18 | + type: choice |
| 19 | + options: |
| 20 | + - windows-latest-x64-zip |
| 21 | + - windows-latest-x64-nsis |
| 22 | + - windows-11-arm-arm64-zip |
| 23 | + - windows-11-arm-arm64-nsis |
| 24 | + - macos-15-intel-x64-dmg |
| 25 | + - macos-latest-arm64-dmg |
| 26 | + - ubuntu-latest-x64-AppImage |
| 27 | + - ubuntu-latest-x64-deb |
| 28 | + - ubuntu-latest-x64-snap |
| 29 | + - ubuntu-latest-x64-rpm |
| 30 | + - ubuntu-24.04-arm-arm64-AppImage |
| 31 | + - ubuntu-24.04-arm-arm64-deb |
| 32 | + - ubuntu-24.04-arm-arm64-rpm |
| 33 | + - All |
| 34 | +permissions: |
| 35 | + contents: read |
| 36 | + |
| 37 | +env: |
| 38 | + ELECTRON_OUTPUT_PATH: ./dist_electron |
| 39 | + CSC_LINK: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} |
| 40 | + CSC_KEY_PASSWORD: ${{ secrets.P12_PASSWORD }} |
| 41 | + USE_HARD_LINKS: false |
| 42 | + |
| 43 | +jobs: |
| 44 | + build: |
| 45 | + runs-on: ${{ matrix.os }} |
| 46 | + strategy: |
| 47 | + fail-fast: false |
| 48 | + matrix: |
| 49 | + include: |
| 50 | + - os: windows-latest |
| 51 | + arch: x64 |
| 52 | + format: zip |
| 53 | + filter: windows-latest-x64-zip |
| 54 | + - os: windows-latest |
| 55 | + arch: x64 |
| 56 | + format: nsis |
| 57 | + filter: windows-latest-x64-nsis |
| 58 | + - os: windows-11-arm |
| 59 | + arch: arm64 |
| 60 | + format: zip |
| 61 | + filter: windows-11-arm-arm64-zip |
| 62 | + - os: windows-11-arm |
| 63 | + arch: arm64 |
| 64 | + format: nsis |
| 65 | + filter: windows-11-arm-arm64-nsis |
| 66 | + - os: macos-15-intel |
| 67 | + arch: x64 |
| 68 | + format: dmg |
| 69 | + filter: macos-15-intel-x64-dmg |
| 70 | + - os: macos-latest |
| 71 | + arch: arm64 |
| 72 | + format: dmg |
| 73 | + filter: macos-latest-arm64-dmg |
| 74 | + - os: ubuntu-latest |
| 75 | + arch: x64 |
| 76 | + format: AppImage |
| 77 | + filter: ubuntu-latest-x64-AppImage |
| 78 | + - os: ubuntu-latest |
| 79 | + arch: x64 |
| 80 | + format: deb |
| 81 | + filter: ubuntu-latest-x64-deb |
| 82 | + - os: ubuntu-latest |
| 83 | + arch: x64 |
| 84 | + format: snap |
| 85 | + filter: ubuntu-latest-x64-snap |
| 86 | + - os: ubuntu-latest |
| 87 | + arch: x64 |
| 88 | + format: rpm |
| 89 | + filter: ubuntu-latest-x64-rpm |
| 90 | + - os: ubuntu-24.04-arm |
| 91 | + arch: arm64 |
| 92 | + format: AppImage |
| 93 | + filter: ubuntu-24.04-arm-arm64-AppImage |
| 94 | + - os: ubuntu-24.04-arm |
| 95 | + arch: arm64 |
| 96 | + format: deb |
| 97 | + filter: ubuntu-24.04-arm-arm64-deb |
| 98 | + - os: ubuntu-24.04-arm |
| 99 | + arch: arm64 |
| 100 | + format: rpm |
| 101 | + filter: ubuntu-24.04-arm-arm64-rpm |
| 102 | + name: Build on ${{ matrix.os }} for ${{ matrix.arch }} - ${{ matrix.format }} |
| 103 | + steps: |
| 104 | + - name: Set up git config |
| 105 | + run: | |
| 106 | + git config --global core.autocrlf false |
| 107 | +
|
| 108 | + - name: Checkout |
| 109 | + uses: actions/checkout@v6 |
| 110 | + |
| 111 | + # step2: sign |
| 112 | + - name: Install the Apple certificates |
| 113 | + if: contains(matrix.os, 'macos') && (github.event.inputs.build_os == matrix.filter || github.event.inputs.build_os == 'All') |
| 114 | + run: | |
| 115 | + CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 |
| 116 | + echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH |
| 117 | +
|
| 118 | + # step3: install node env |
| 119 | + - name: Install Node.js |
| 120 | + uses: actions/setup-node@v6 |
| 121 | + with: |
| 122 | + node-version: "22.x" |
| 123 | + |
| 124 | + - name: Install system deps |
| 125 | + if: contains(matrix.os, 'linux') && (github.event.inputs.build_os == matrix.filter || github.event.inputs.build_os == 'All') |
| 126 | + run: | |
| 127 | + sudo apt-get install --no-install-recommends -y icnsutils graphicsmagick xz-utils libfuse2 |
| 128 | + sudo snap install snapcraft --classic |
| 129 | +
|
| 130 | + - name: Install FPM |
| 131 | + if: matrix.os == 'ubuntu-24.04-arm' && (github.event.inputs.build_os == matrix.filter || github.event.inputs.build_os == 'All') |
| 132 | + run: | |
| 133 | + sudo apt-get update |
| 134 | + sudo apt-get install -y ruby ruby-dev build-essential |
| 135 | + sudo gem install --no-document fpm |
| 136 | +
|
| 137 | + # step3: yarn |
| 138 | + - name: Install dependencies |
| 139 | + if: github.event.inputs.build_os == matrix.filter || github.event.inputs.build_os == 'All' |
| 140 | + shell: bash |
| 141 | + run: | |
| 142 | + yarn config set ignore-engines true |
| 143 | + rm -rf node_modules dist_electron && yarn install --frozen-lockfile |
| 144 | + yarn global add xvfb-maybe |
| 145 | +
|
| 146 | + - name: Generate release notes |
| 147 | + if: github.event.inputs.build_os == matrix.filter || github.event.inputs.build_os == 'All' |
| 148 | + shell: bash |
| 149 | + run: | |
| 150 | + chmod +x ./scripts/generate-release-notes.sh |
| 151 | + ./scripts/generate-release-notes.sh |
| 152 | +
|
| 153 | + - name: Configure electron-builder.json |
| 154 | + if: github.event.inputs.build_os == matrix.filter || github.event.inputs.build_os == 'All' |
| 155 | + shell: bash |
| 156 | + run: | |
| 157 | + # Remove publish config if not publishing |
| 158 | + if [ "${{ github.event.inputs.publish_enabled }}" == "false" ]; then |
| 159 | + jq 'del(.publish)' electron-builder.json > tmp.json && mv tmp.json electron-builder.json |
| 160 | + fi |
| 161 | +
|
| 162 | + - name: Build & release app |
| 163 | + if: github.event.inputs.build_os == matrix.filter || github.event.inputs.build_os == 'All' |
| 164 | + shell: bash |
| 165 | + run: | |
| 166 | + if [ "${{ matrix.os }}" == "windows-11-arm" ]; then |
| 167 | + export CSC_IDENTITY_AUTO_DISCOVERY=false |
| 168 | + unset CSC_LINK WIN_CSC_LINK CSC_KEY_PASSWORD |
| 169 | + fi |
| 170 | + PUBLISH_ARG="never" |
| 171 | + if [ "${{ github.event.inputs.publish_enabled }}" == "true" ]; then |
| 172 | + PUBLISH_ARG="always" |
| 173 | + fi |
| 174 | + echo "Publishing argument: $PUBLISH_ARG" |
| 175 | + if [[ "${{ matrix.os }}" == windows* ]]; then |
| 176 | + yarn run build:win --publish $PUBLISH_ARG ${{ matrix.format}} --${{ matrix.arch }} |
| 177 | + elif [[ "${{ matrix.os }}" == macos* ]]; then |
| 178 | + yarn run build:mac --publish $PUBLISH_ARG ${{ matrix.format}} --${{ matrix.arch }} |
| 179 | + elif [[ "${{ matrix.os }}" == ubuntu* ]]; then |
| 180 | + yarn run build:linux --publish $PUBLISH_ARG ${{ matrix.format}} --${{ matrix.arch }} |
| 181 | + else |
| 182 | + echo "Unsupported OS: ${{ matrix.os }}" |
| 183 | + exit 1 |
| 184 | + fi |
| 185 | + env: |
| 186 | + USE_SYSTEM_FPM: ${{ matrix.os == 'ubuntu-24.04-arm' && 'true' || 'false' }} |
| 187 | + GH_TOKEN: ${{ secrets.GH_TOKEN }} |
| 188 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 189 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 190 | + R2_SECRET_ID: ${{ secrets.R2_SECRET_ID }} |
| 191 | + R2_SECRET_KEY: ${{ secrets.R2_SECRET_KEY }} |
| 192 | + R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }} |
| 193 | + ELECTRON_SKIP_NOTARIZATION: ${{ secrets.ELECTRON_SKIP_NOTARIZATION }} |
| 194 | + XCODE_APP_LOADER_EMAIL: ${{ secrets.XCODE_APP_LOADER_EMAIL }} |
| 195 | + XCODE_APP_LOADER_PASSWORD: ${{ secrets.XCODE_APP_LOADER_PASSWORD }} |
| 196 | + XCODE_TEAM_ID: ${{ secrets.XCODE_TEAM_ID }} |
| 197 | + BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} |
| 198 | + P12_PASSWORD: ${{ secrets.P12_PASSWORD }} |
| 199 | + BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }} |
| 200 | + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} |
| 201 | + USE_HARD_LINKS: false |
| 202 | + |
| 203 | + - name: Upload build artifacts |
| 204 | + if: github.event.inputs.build_os == matrix.filter || github.event.inputs.build_os == 'All' |
| 205 | + uses: actions/upload-artifact@v4 |
| 206 | + with: |
| 207 | + name: ${{ matrix.filter }}-artifacts |
| 208 | + path: | |
| 209 | + dist_electron/*.exe |
| 210 | + dist_electron/*.dmg |
| 211 | + dist_electron/*.zip |
| 212 | + dist_electron/*.AppImage |
| 213 | + dist_electron/*.deb |
| 214 | + dist_electron/*.rpm |
| 215 | + dist_electron/*.snap |
| 216 | + retention-days: 30 |
| 217 | + if-no-files-found: 'ignore' |
| 218 | + |
| 219 | + - name: Upload yml artifacts |
| 220 | + if: github.event.inputs.build_os == matrix.filter || github.event.inputs.build_os == 'All' |
| 221 | + uses: actions/upload-artifact@v4 |
| 222 | + with: |
| 223 | + name: ${{ matrix.filter }}-yml |
| 224 | + path: dist_electron/**/*.yml |
| 225 | + retention-days: 30 |
| 226 | + if-no-files-found: 'ignore' |
0 commit comments