|
5 | 5 | types: [published] |
6 | 6 |
|
7 | 7 | permissions: |
| 8 | + actions: read |
8 | 9 | id-token: write |
9 | 10 | contents: write |
10 | 11 |
|
|
18 | 19 | # upstream fix (oven-sh/bun#29122). |
19 | 20 | CLI_BUN_VERSION: '1.3.11' |
20 | 21 | HOMEBREW_TAP_REPO: appwrite/homebrew-appwrite |
| 22 | + WINDOWS_SIGNING_PROJECT_SLUG: ${{ vars.WINDOWS_SIGNING_PROJECT_SLUG || 'sdk-for-cli' }} |
| 23 | + WINDOWS_SIGNING_POLICY_SLUG: ${{ vars.WINDOWS_SIGNING_POLICY_SLUG || 'release-signing' }} |
| 24 | + WINDOWS_SIGNING_ARTIFACT_CONFIGURATION_SLUG: ${{ vars.WINDOWS_SIGNING_ARTIFACT_CONFIGURATION_SLUG || 'initial' }} |
21 | 25 | steps: |
22 | 26 | - uses: actions/checkout@v6 |
23 | 27 | with: |
|
29 | 33 | - name: Setup binfmt with QEMU |
30 | 34 | run: | |
31 | 35 | sudo apt update |
32 | | - sudo apt install qemu-system binfmt-support qemu-user-static |
| 36 | + sudo apt install qemu-system binfmt-support qemu-user-static osslsigncode |
33 | 37 | update-binfmts --display |
34 | 38 |
|
35 | 39 | - name: Setup ldid |
|
49 | 53 | bun run windows-x64 |
50 | 54 | bun run windows-arm64 |
51 | 55 |
|
| 56 | + - name: Upload unsigned Windows binaries |
| 57 | + id: upload-windows-unsigned |
| 58 | + uses: actions/upload-artifact@v4 |
| 59 | + with: |
| 60 | + name: windows-unsigned |
| 61 | + path: | |
| 62 | + build/appwrite-cli-win-x64.exe |
| 63 | + build/appwrite-cli-win-arm64.exe |
| 64 | +
|
| 65 | + - name: Submit Windows binaries for signing |
| 66 | + uses: signpath/github-action-submit-signing-request@b9d91eadd323de506c0c81cf0c7fe7438f3360fd # v2 |
| 67 | + with: |
| 68 | + api-token: ${{ secrets.WINDOWS_SIGNING_API_TOKEN }} |
| 69 | + organization-id: ${{ vars.WINDOWS_SIGNING_ORGANIZATION_ID }} |
| 70 | + project-slug: ${{ env.WINDOWS_SIGNING_PROJECT_SLUG }} |
| 71 | + signing-policy-slug: ${{ env.WINDOWS_SIGNING_POLICY_SLUG }} |
| 72 | + artifact-configuration-slug: ${{ env.WINDOWS_SIGNING_ARTIFACT_CONFIGURATION_SLUG }} |
| 73 | + github-artifact-id: ${{ steps.upload-windows-unsigned.outputs.artifact-id }} |
| 74 | + wait-for-completion: true |
| 75 | + output-artifact-directory: build-signed |
| 76 | + parameters: | |
| 77 | + version: ${{ github.event.release.tag_name }} |
| 78 | +
|
| 79 | + - name: Replace unsigned Windows binaries |
| 80 | + run: | |
| 81 | + set -euo pipefail |
| 82 | +
|
| 83 | + signed_x64="$(find build-signed -type f -name 'appwrite-cli-win-x64.exe' -print -quit)" |
| 84 | + signed_arm64="$(find build-signed -type f -name 'appwrite-cli-win-arm64.exe' -print -quit)" |
| 85 | +
|
| 86 | + if [ -z "$signed_x64" ] || [ -z "$signed_arm64" ]; then |
| 87 | + echo "Signed Windows binaries were not found in build-signed" |
| 88 | + find build-signed -type f -print |
| 89 | + exit 1 |
| 90 | + fi |
| 91 | +
|
| 92 | + cp "$signed_x64" build/appwrite-cli-win-x64.exe |
| 93 | + cp "$signed_arm64" build/appwrite-cli-win-arm64.exe |
| 94 | +
|
| 95 | + - name: Verify Windows signatures |
| 96 | + run: | |
| 97 | + set -euo pipefail |
| 98 | +
|
| 99 | + verify_signature() { |
| 100 | + local file="$1" |
| 101 | + local output |
| 102 | +
|
| 103 | + output="$(osslsigncode verify -in "$file" 2>&1)" |
| 104 | + echo "$output" |
| 105 | +
|
| 106 | + if ! grep -Fq "Succeeded" <<< "$output"; then |
| 107 | + echo "$file signature verification failed" |
| 108 | + exit 1 |
| 109 | + fi |
| 110 | + } |
| 111 | +
|
| 112 | + verify_signature build/appwrite-cli-win-x64.exe |
| 113 | + verify_signature build/appwrite-cli-win-arm64.exe |
| 114 | +
|
52 | 115 | - name: Setup Node.js |
53 | 116 | uses: actions/setup-node@v6 |
54 | 117 | with: |
|
0 commit comments