|
| 1 | +name: Bundle App |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + app_path: |
| 7 | + description: 'Path to app directory (relative to repo root)' |
| 8 | + required: true |
| 9 | + default: 'apps/example-deno-app' |
| 10 | + sign_windows: |
| 11 | + description: 'Sign Windows MSIX package' |
| 12 | + required: false |
| 13 | + default: 'false' |
| 14 | + type: boolean |
| 15 | + sign_macos: |
| 16 | + description: 'Sign and notarize macOS app' |
| 17 | + required: false |
| 18 | + default: 'false' |
| 19 | + type: boolean |
| 20 | + |
| 21 | +env: |
| 22 | + CARGO_TERM_COLOR: always |
| 23 | + APP_PATH: ${{ github.event.inputs.app_path }} |
| 24 | + |
| 25 | +jobs: |
| 26 | + bundle-windows: |
| 27 | + name: Bundle Windows MSIX |
| 28 | + runs-on: windows-latest |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Install Rust toolchain |
| 33 | + uses: dtolnay/rust-action@stable |
| 34 | + |
| 35 | + - name: Install Deno |
| 36 | + uses: denoland/setup-deno@v1 |
| 37 | + with: |
| 38 | + deno-version: v1.x |
| 39 | + |
| 40 | + - name: Cache cargo |
| 41 | + uses: actions/cache@v4 |
| 42 | + with: |
| 43 | + path: | |
| 44 | + ~/.cargo/bin/ |
| 45 | + ~/.cargo/registry/index/ |
| 46 | + ~/.cargo/registry/cache/ |
| 47 | + ~/.cargo/git/db/ |
| 48 | + target/ |
| 49 | + key: ${{ runner.os }}-cargo-bundle-${{ hashFiles('**/Cargo.lock') }} |
| 50 | + |
| 51 | + - name: Build app |
| 52 | + run: cargo run -p forge -- build ${{ env.APP_PATH }} |
| 53 | + |
| 54 | + - name: Bundle app |
| 55 | + run: cargo run -p forge -- bundle ${{ env.APP_PATH }} |
| 56 | + |
| 57 | + - name: Sign MSIX (if requested) |
| 58 | + if: github.event.inputs.sign_windows == 'true' |
| 59 | + run: | |
| 60 | + # Import certificate from secrets |
| 61 | + echo "${{ secrets.WINDOWS_CERTIFICATE }}" | base64 -d > cert.pfx |
| 62 | + cargo run -p forge -- sign --identity cert.pfx ${{ env.APP_PATH }}/bundle/*.msix |
| 63 | + rm cert.pfx |
| 64 | + env: |
| 65 | + FORGE_SIGNING_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }} |
| 66 | + |
| 67 | + - name: Upload MSIX |
| 68 | + uses: actions/upload-artifact@v4 |
| 69 | + with: |
| 70 | + name: windows-msix |
| 71 | + path: ${{ env.APP_PATH }}/bundle/*.msix |
| 72 | + |
| 73 | + bundle-macos: |
| 74 | + name: Bundle macOS DMG |
| 75 | + runs-on: macos-latest |
| 76 | + steps: |
| 77 | + - uses: actions/checkout@v4 |
| 78 | + |
| 79 | + - name: Install Rust toolchain |
| 80 | + uses: dtolnay/rust-action@stable |
| 81 | + |
| 82 | + - name: Install Deno |
| 83 | + uses: denoland/setup-deno@v1 |
| 84 | + with: |
| 85 | + deno-version: v1.x |
| 86 | + |
| 87 | + - name: Cache cargo |
| 88 | + uses: actions/cache@v4 |
| 89 | + with: |
| 90 | + path: | |
| 91 | + ~/.cargo/bin/ |
| 92 | + ~/.cargo/registry/index/ |
| 93 | + ~/.cargo/registry/cache/ |
| 94 | + ~/.cargo/git/db/ |
| 95 | + target/ |
| 96 | + key: ${{ runner.os }}-cargo-bundle-${{ hashFiles('**/Cargo.lock') }} |
| 97 | + |
| 98 | + - name: Build app |
| 99 | + run: cargo run -p forge -- build ${{ env.APP_PATH }} |
| 100 | + |
| 101 | + - name: Import signing certificate (if requested) |
| 102 | + if: github.event.inputs.sign_macos == 'true' |
| 103 | + run: | |
| 104 | + # Create keychain |
| 105 | + security create-keychain -p "" build.keychain |
| 106 | + security set-keychain-settings build.keychain |
| 107 | + security unlock-keychain -p "" build.keychain |
| 108 | +
|
| 109 | + # Import certificate |
| 110 | + echo "${{ secrets.MACOS_CERTIFICATE }}" | base64 -d > cert.p12 |
| 111 | + security import cert.p12 -k build.keychain -P "${{ secrets.MACOS_CERTIFICATE_PASSWORD }}" -T /usr/bin/codesign |
| 112 | + rm cert.p12 |
| 113 | +
|
| 114 | + # Set keychain to be used |
| 115 | + security list-keychains -s build.keychain |
| 116 | + security default-keychain -s build.keychain |
| 117 | +
|
| 118 | + # Allow codesign to access keychain |
| 119 | + security set-key-partition-list -S apple-tool:,apple: -s -k "" build.keychain |
| 120 | + env: |
| 121 | + MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} |
| 122 | + MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} |
| 123 | + |
| 124 | + - name: Setup notarization credentials (if requested) |
| 125 | + if: github.event.inputs.sign_macos == 'true' |
| 126 | + run: | |
| 127 | + xcrun notarytool store-credentials "forge-notarize" \ |
| 128 | + --apple-id "${{ secrets.APPLE_ID }}" \ |
| 129 | + --team-id "${{ secrets.APPLE_TEAM_ID }}" \ |
| 130 | + --password "${{ secrets.APPLE_APP_PASSWORD }}" |
| 131 | + env: |
| 132 | + APPLE_ID: ${{ secrets.APPLE_ID }} |
| 133 | + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} |
| 134 | + APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }} |
| 135 | + |
| 136 | + - name: Bundle app |
| 137 | + run: cargo run -p forge -- bundle ${{ env.APP_PATH }} |
| 138 | + env: |
| 139 | + FORGE_SIGNING_IDENTITY: ${{ github.event.inputs.sign_macos == 'true' && secrets.MACOS_SIGNING_IDENTITY || '' }} |
| 140 | + FORGE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} |
| 141 | + FORGE_NOTARIZE: ${{ github.event.inputs.sign_macos }} |
| 142 | + |
| 143 | + - name: Cleanup keychain |
| 144 | + if: always() && github.event.inputs.sign_macos == 'true' |
| 145 | + run: security delete-keychain build.keychain |
| 146 | + |
| 147 | + - name: Upload DMG |
| 148 | + uses: actions/upload-artifact@v4 |
| 149 | + with: |
| 150 | + name: macos-dmg |
| 151 | + path: | |
| 152 | + ${{ env.APP_PATH }}/bundle/*.dmg |
| 153 | + ${{ env.APP_PATH }}/bundle/*.app |
| 154 | +
|
| 155 | + bundle-linux: |
| 156 | + name: Bundle Linux AppImage |
| 157 | + runs-on: ubuntu-latest |
| 158 | + steps: |
| 159 | + - uses: actions/checkout@v4 |
| 160 | + |
| 161 | + - name: Install Rust toolchain |
| 162 | + uses: dtolnay/rust-action@stable |
| 163 | + |
| 164 | + - name: Install Deno |
| 165 | + uses: denoland/setup-deno@v1 |
| 166 | + with: |
| 167 | + deno-version: v1.x |
| 168 | + |
| 169 | + - name: Install system dependencies |
| 170 | + run: | |
| 171 | + sudo apt-get update |
| 172 | + sudo apt-get install -y \ |
| 173 | + libwebkit2gtk-4.1-dev \ |
| 174 | + libgtk-3-dev \ |
| 175 | + libayatana-appindicator3-dev \ |
| 176 | + squashfs-tools \ |
| 177 | + fuse |
| 178 | +
|
| 179 | + - name: Install appimagetool |
| 180 | + run: | |
| 181 | + wget -q https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage |
| 182 | + chmod +x appimagetool-x86_64.AppImage |
| 183 | + sudo mv appimagetool-x86_64.AppImage /usr/local/bin/appimagetool |
| 184 | +
|
| 185 | + - name: Cache cargo |
| 186 | + uses: actions/cache@v4 |
| 187 | + with: |
| 188 | + path: | |
| 189 | + ~/.cargo/bin/ |
| 190 | + ~/.cargo/registry/index/ |
| 191 | + ~/.cargo/registry/cache/ |
| 192 | + ~/.cargo/git/db/ |
| 193 | + target/ |
| 194 | + key: ${{ runner.os }}-cargo-bundle-${{ hashFiles('**/Cargo.lock') }} |
| 195 | + |
| 196 | + - name: Build app |
| 197 | + run: cargo run -p forge -- build ${{ env.APP_PATH }} |
| 198 | + |
| 199 | + - name: Bundle app |
| 200 | + run: cargo run -p forge -- bundle ${{ env.APP_PATH }} |
| 201 | + |
| 202 | + - name: Upload AppImage |
| 203 | + uses: actions/upload-artifact@v4 |
| 204 | + with: |
| 205 | + name: linux-appimage |
| 206 | + path: | |
| 207 | + ${{ env.APP_PATH }}/bundle/*.AppImage |
| 208 | + ${{ env.APP_PATH }}/bundle/*.tar.gz |
0 commit comments