|
32 | 32 | CODER_RELEASE_NOTES: ${{ inputs.release_notes }}
|
33 | 33 |
|
34 | 34 | jobs:
|
| 35 | + # build-dylib is a separate job to build the dylib on macOS. |
| 36 | + build-dylib: |
| 37 | + runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest' }} |
| 38 | + steps: |
| 39 | + - name: Harden Runner |
| 40 | + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 |
| 41 | + with: |
| 42 | + egress-policy: audit |
| 43 | + |
| 44 | + - name: Checkout |
| 45 | + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 |
| 46 | + with: |
| 47 | + fetch-depth: 0 |
| 48 | + |
| 49 | + - name: Setup build tools |
| 50 | + run: | |
| 51 | + brew install bash gnu-getopt make |
| 52 | + echo "$(brew --prefix bash)/bin" >> $GITHUB_PATH |
| 53 | + echo "$(brew --prefix gnu-getopt)/bin" >> $GITHUB_PATH |
| 54 | + echo "$(brew --prefix make)/libexec/gnubin" >> $GITHUB_PATH |
| 55 | +
|
| 56 | + - name: Setup Go |
| 57 | + uses: ./.github/actions/setup-go |
| 58 | + |
| 59 | + - name: Install rcodesign |
| 60 | + run: | |
| 61 | + set -euo pipefail |
| 62 | + wget -O /tmp/rcodesign.tar.gz https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F0.22.0/apple-codesign-0.22.0-macos-universal.tar.gz |
| 63 | + sudo tar -xzf /tmp/rcodesign.tar.gz \ |
| 64 | + -C /usr/local/bin \ |
| 65 | + --strip-components=1 \ |
| 66 | + apple-codesign-0.22.0-macos-universal/rcodesign |
| 67 | + rm /tmp/rcodesign.tar.gz |
| 68 | +
|
| 69 | + - name: Setup Apple Developer certificate and API key |
| 70 | + run: | |
| 71 | + set -euo pipefail |
| 72 | + touch /tmp/{apple_cert.p12,apple_cert_password.txt,apple_apikey.p8} |
| 73 | + chmod 600 /tmp/{apple_cert.p12,apple_cert_password.txt,apple_apikey.p8} |
| 74 | + echo "$AC_CERTIFICATE_P12_BASE64" | base64 -d > /tmp/apple_cert.p12 |
| 75 | + echo "$AC_CERTIFICATE_PASSWORD" > /tmp/apple_cert_password.txt |
| 76 | + echo "$AC_APIKEY_P8_BASE64" | base64 -d > /tmp/apple_apikey.p8 |
| 77 | + env: |
| 78 | + AC_CERTIFICATE_P12_BASE64: ${{ secrets.AC_CERTIFICATE_P12_BASE64 }} |
| 79 | + AC_CERTIFICATE_PASSWORD: ${{ secrets.AC_CERTIFICATE_PASSWORD }} |
| 80 | + AC_APIKEY_P8_BASE64: ${{ secrets.AC_APIKEY_P8_BASE64 }} |
| 81 | + |
| 82 | + - name: Build dylibs |
| 83 | + run: | |
| 84 | + set -euxo pipefail |
| 85 | + go mod download |
| 86 | +
|
| 87 | + make gen/mark-fresh |
| 88 | + make build/coder-dylib |
| 89 | + env: |
| 90 | + CODER_SIGN_DARWIN: 1 |
| 91 | + AC_CERTIFICATE_FILE: /tmp/apple_cert.p12 |
| 92 | + AC_CERTIFICATE_PASSWORD_FILE: /tmp/apple_cert_password.txt |
| 93 | + |
| 94 | + - name: Upload build artifacts |
| 95 | + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 |
| 96 | + with: |
| 97 | + name: dylibs |
| 98 | + path: | |
| 99 | + ./build/*.h |
| 100 | + ./build/*.dylib |
| 101 | + retention-days: 7 |
| 102 | + |
| 103 | + - name: Delete Apple Developer certificate and API key |
| 104 | + run: rm -f /tmp/{apple_cert.p12,apple_cert_password.txt,apple_apikey.p8} |
| 105 | + |
35 | 106 | release:
|
36 | 107 | name: Build and publish
|
| 108 | + needs: build-dylib |
37 | 109 | runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
|
38 | 110 | permissions:
|
39 | 111 | # Required to publish a release
|
@@ -145,6 +217,18 @@ jobs:
|
145 | 217 | - name: Install nsis and zstd
|
146 | 218 | run: sudo apt-get install -y nsis zstd
|
147 | 219 |
|
| 220 | + - name: Download dylibs |
| 221 | + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 |
| 222 | + with: |
| 223 | + name: dylibs |
| 224 | + path: ./build |
| 225 | + |
| 226 | + - name: Insert dylibs |
| 227 | + run: | |
| 228 | + mv ./build/*amd64.dylib ./site/out/bin/coder-vpn-darwin-amd64.dylib |
| 229 | + mv ./build/*arm64.dylib ./site/out/bin/coder-vpn-darwin-arm64.dylib |
| 230 | + mv ./build/*arm64.h ./site/out/bin/coder-vpn-darwin-dylib.h |
| 231 | +
|
148 | 232 | - name: Install nfpm
|
149 | 233 | run: |
|
150 | 234 | set -euo pipefail
|
|
0 commit comments