|
| 1 | +name: Build KeepKey Desktop v3.2.0 Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + build-release: |
| 8 | + runs-on: ${{ matrix.os }} |
| 9 | + strategy: |
| 10 | + fail-fast: false |
| 11 | + matrix: |
| 12 | + os: [ubuntu-latest, windows-latest, macos-14] |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Checkout v3.2.0 tag |
| 16 | + uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + ref: v3.2.0 |
| 19 | + submodules: true |
| 20 | + |
| 21 | + - name: Setup Node |
| 22 | + uses: actions/setup-node@v4 |
| 23 | + with: |
| 24 | + node-version-file: '.nvmrc' |
| 25 | + |
| 26 | + - name: Cache Dependencies |
| 27 | + uses: actions/cache@v4 |
| 28 | + with: |
| 29 | + path: | |
| 30 | + ~/.cache/electron |
| 31 | + ~/Library/Caches/electron |
| 32 | + ~/AppData/Local/electron/Cache |
| 33 | + .yarn/cache |
| 34 | + key: ${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock') }} |
| 35 | + restore-keys: ${{ runner.os }}-deps- |
| 36 | + |
| 37 | + - name: Install Dependencies |
| 38 | + run: yarn install |
| 39 | + |
| 40 | + - name: Build Application |
| 41 | + run: yarn build |
| 42 | + |
| 43 | + - name: Build Windows Packages |
| 44 | + if: startsWith(matrix.os, 'windows') |
| 45 | + run: | |
| 46 | + cd packages/keepkey-desktop |
| 47 | + yarn electron-builder --win --publish=never |
| 48 | + env: |
| 49 | + NODE_ENV: production |
| 50 | + |
| 51 | + - name: Build macOS Packages |
| 52 | + if: startsWith(matrix.os, 'macos') |
| 53 | + run: | |
| 54 | + cd packages/keepkey-desktop |
| 55 | + yarn electron-builder --mac --publish=never |
| 56 | + env: |
| 57 | + NODE_ENV: production |
| 58 | + |
| 59 | + - name: Build Linux Packages |
| 60 | + if: startsWith(matrix.os, 'ubuntu') |
| 61 | + run: | |
| 62 | + cd packages/keepkey-desktop |
| 63 | + yarn electron-builder --linux --publish=never |
| 64 | + env: |
| 65 | + NODE_ENV: production |
| 66 | + |
| 67 | + - name: Upload Windows Artifacts |
| 68 | + if: startsWith(matrix.os, 'windows') |
| 69 | + uses: actions/upload-artifact@v4 |
| 70 | + with: |
| 71 | + name: windows-packages |
| 72 | + path: | |
| 73 | + packages/keepkey-desktop/dist/*.exe |
| 74 | + packages/keepkey-desktop/dist/*.msi |
| 75 | + packages/keepkey-desktop/dist/*.exe.blockmap |
| 76 | + packages/keepkey-desktop/dist/*.msi.blockmap |
| 77 | + if-no-files-found: error |
| 78 | + |
| 79 | + - name: Upload macOS Artifacts |
| 80 | + if: startsWith(matrix.os, 'macos') |
| 81 | + uses: actions/upload-artifact@v4 |
| 82 | + with: |
| 83 | + name: macos-packages |
| 84 | + path: | |
| 85 | + packages/keepkey-desktop/dist/*.dmg |
| 86 | + packages/keepkey-desktop/dist/*.zip |
| 87 | + packages/keepkey-desktop/dist/*.dmg.blockmap |
| 88 | + if-no-files-found: error |
| 89 | + |
| 90 | + - name: Upload Linux Artifacts |
| 91 | + if: startsWith(matrix.os, 'ubuntu') |
| 92 | + uses: actions/upload-artifact@v4 |
| 93 | + with: |
| 94 | + name: linux-packages |
| 95 | + path: | |
| 96 | + packages/keepkey-desktop/dist/*.deb |
| 97 | + packages/keepkey-desktop/dist/*.AppImage |
| 98 | + packages/keepkey-desktop/dist/*.deb.blockmap |
| 99 | + packages/keepkey-desktop/dist/*.AppImage.blockmap |
| 100 | + if-no-files-found: error |
| 101 | + |
| 102 | + sign-and-upload: |
| 103 | + needs: build-release |
| 104 | + runs-on: windows-latest |
| 105 | + steps: |
| 106 | + - name: Download Windows Artifacts |
| 107 | + uses: actions/download-artifact@v4 |
| 108 | + with: |
| 109 | + name: windows-packages |
| 110 | + path: ./windows-packages |
| 111 | + |
| 112 | + - name: List Downloaded Files |
| 113 | + run: | |
| 114 | + Write-Host "Downloaded Windows packages:" |
| 115 | + Get-ChildItem -Path ./windows-packages -Recurse | ForEach-Object { |
| 116 | + Write-Host " $($_.Name) ($([math]::Round($_.Length / 1MB, 2)) MB)" |
| 117 | + } |
| 118 | +
|
| 119 | + - name: Sign Windows Packages (if certificate available) |
| 120 | + run: | |
| 121 | + $signTool = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\signtool.exe" |
| 122 | + $thumbprint = "986AEBA61CF6616393E74D8CBD3A09E836213BAA" |
| 123 | + |
| 124 | + if (Test-Path $signTool) { |
| 125 | + Write-Host "SignTool found, checking for certificate..." |
| 126 | + $cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where-Object { $_.Thumbprint -eq $thumbprint } |
| 127 | + if (-not $cert) { |
| 128 | + $cert = Get-ChildItem -Path "Cert:\LocalMachine\My" | Where-Object { $_.Thumbprint -eq $thumbprint } |
| 129 | + } |
| 130 | + |
| 131 | + if ($cert) { |
| 132 | + Write-Host "Certificate found, signing packages..." |
| 133 | + $windowsFiles = Get-ChildItem -Path ./windows-packages -Filter "*.exe" -Recurse |
| 134 | + $windowsFiles += Get-ChildItem -Path ./windows-packages -Filter "*.msi" -Recurse |
| 135 | + |
| 136 | + foreach ($file in $windowsFiles) { |
| 137 | + Write-Host "Signing $($file.Name)..." |
| 138 | + & $signTool sign /sha1 $thumbprint /fd sha256 /tr "http://timestamp.sectigo.com" /td sha256 /v $file.FullName |
| 139 | + } |
| 140 | + } else { |
| 141 | + Write-Host "Certificate not found, skipping signing" |
| 142 | + } |
| 143 | + } else { |
| 144 | + Write-Host "SignTool not found, skipping signing" |
| 145 | + } |
| 146 | +
|
| 147 | + - name: Upload Signed Packages to Release |
| 148 | + run: | |
| 149 | + Write-Host "Uploading packages to v3.2.0 release..." |
| 150 | + $files = Get-ChildItem -Path ./windows-packages -File -Recurse |
| 151 | + foreach ($file in $files) { |
| 152 | + Write-Host "Uploading $($file.Name)..." |
| 153 | + gh release upload v3.2.0 $file.FullName --clobber --repo keepkey/keepkey-desktop |
| 154 | + } |
| 155 | + env: |
| 156 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments