CD #44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CD | |
| on: | |
| workflow_run: | |
| workflows: [CI] | |
| types: [completed] | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: cd-latest | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' | |
| runs-on: macos-latest | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.workflow_run.head_sha || github.sha }} | |
| - name: verify arm64 runner | |
| run: test "$(uname -m)" = arm64 | |
| - name: import release identity | |
| env: | |
| P12_BASE64: ${{ secrets.PROBO_RELEASE_P12_BASE64 }} | |
| P12_PASSWORD: ${{ secrets.PROBO_RELEASE_P12_PASSWORD }} | |
| KEYCHAIN_PASSWORD: ${{ github.run_id }} | |
| run: | | |
| if [[ -z "$P12_BASE64" ]]; then | |
| echo "::warning::PROBO_RELEASE_P12_BASE64 not set; signing ad-hoc" | |
| echo "PROBO_CODESIGN_IDENTITY=-" >> "$GITHUB_ENV" | |
| exit 0 | |
| fi | |
| keychain="$RUNNER_TEMP/probo.keychain-db" | |
| p12="$RUNNER_TEMP/release.p12" | |
| printf %s "$P12_BASE64" | base64 --decode > "$p12" | |
| security create-keychain -p "$KEYCHAIN_PASSWORD" "$keychain" | |
| security set-keychain-settings -lut 21600 "$keychain" | |
| security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$keychain" | |
| security import "$p12" \ | |
| -k "$keychain" \ | |
| -f pkcs12 \ | |
| -P "$P12_PASSWORD" \ | |
| -T /usr/bin/codesign \ | |
| -T /usr/bin/security | |
| security set-key-partition-list \ | |
| -S apple-tool:,apple: \ | |
| -s \ | |
| -k "$KEYCHAIN_PASSWORD" \ | |
| "$keychain" | |
| security list-keychains -d user -s "$keychain" $(security list-keychains -d user | tr -d '"') | |
| identity="$(security find-identity -p codesigning "$keychain" | sed -n 's/.*"\([^"]*\)".*/\1/p' | head -n 1)" | |
| rm "$p12" | |
| echo "PROBO_CODESIGN_IDENTITY=$identity" >> "$GITHUB_ENV" | |
| - name: build arm64 app | |
| run: scripts/build.sh | |
| - name: package | |
| working-directory: build | |
| run: ditto -c -k --keepParent Probo.app Probo-arm64.zip | |
| - name: publish rolling latest | |
| env: | |
| SHA: ${{ github.event.workflow_run.head_sha || github.sha }} | |
| run: | | |
| gh release delete latest --yes --cleanup-tag || true | |
| gh release create latest build/Probo-arm64.zip \ | |
| --title "latest" \ | |
| --notes "rolling release from ${SHA}" \ | |
| --target "${SHA}" |