Release v0.3.0 #1
Workflow file for this run
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag to release (e.g. v0.3.0). For testing — does not move the git tag.' | |
| required: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.target }}) | |
| runs-on: macos-14 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: aarch64-apple-darwin | |
| arch: arm64 | |
| - target: x86_64-apple-darwin | |
| arch: x86_64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Resolve tag | |
| id: tag | |
| shell: bash | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cache cargo registry + target | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }} | |
| - name: Build release binary | |
| run: cargo build --release --locked --target ${{ matrix.target }} | |
| # Codesign + notarize only when the Apple secrets are present. | |
| # Without them the artifact is still produced — users see a Gatekeeper | |
| # warning on first launch and must right-click → Open once. | |
| - name: Codesign + notarize | |
| if: env.APPLE_ID != '' | |
| env: | |
| APPLE_ID: ${{ secrets.APPLE_ID }} | |
| APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
| APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} | |
| APPLE_DEVELOPER_ID: ${{ secrets.APPLE_DEVELOPER_ID }} | |
| APPLE_CERTIFICATE_P12_BASE64: ${{ secrets.APPLE_CERTIFICATE_P12_BASE64 }} | |
| APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| BIN=target/${{ matrix.target }}/release/small-harness | |
| # Import the certificate into a temporary keychain. | |
| KEYCHAIN=build.keychain | |
| KEYCHAIN_PASSWORD=$(openssl rand -hex 16) | |
| security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN" | |
| security default-keychain -s "$KEYCHAIN" | |
| security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN" | |
| security set-keychain-settings -lut 21600 "$KEYCHAIN" | |
| CERT_PATH=$RUNNER_TEMP/dev-id.p12 | |
| echo "$APPLE_CERTIFICATE_P12_BASE64" | base64 --decode > "$CERT_PATH" | |
| security import "$CERT_PATH" -k "$KEYCHAIN" \ | |
| -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign | |
| security set-key-partition-list -S apple-tool:,apple: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN" | |
| codesign --force --options runtime --timestamp \ | |
| --sign "$APPLE_DEVELOPER_ID" "$BIN" | |
| # Notarize via ditto-zipped binary, then staple is N/A for a bare | |
| # binary (no app bundle). The signature + notarization ticket lives | |
| # on Apple's servers; Gatekeeper queries online on first launch. | |
| ZIP=$RUNNER_TEMP/small-harness-${{ matrix.target }}.zip | |
| ditto -c -k --keepParent "$BIN" "$ZIP" | |
| xcrun notarytool submit "$ZIP" \ | |
| --apple-id "$APPLE_ID" \ | |
| --team-id "$APPLE_TEAM_ID" \ | |
| --password "$APPLE_APP_SPECIFIC_PASSWORD" \ | |
| --wait | |
| - name: Package tarball + checksum | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| OUT_DIR="$RUNNER_TEMP/dist" | |
| mkdir -p "$OUT_DIR" | |
| NAME="small-harness-${{ steps.tag.outputs.tag }}-${{ matrix.target }}" | |
| ARTIFACT="$OUT_DIR/$NAME.tar.gz" | |
| tar -czf "$ARTIFACT" \ | |
| -C target/${{ matrix.target }}/release small-harness \ | |
| -C "$GITHUB_WORKSPACE" LICENSE README.md Quickstart.md | |
| (cd "$OUT_DIR" && shasum -a 256 "$NAME.tar.gz" > "$NAME.sha256") | |
| echo "ARTIFACT_DIR=$OUT_DIR" >> "$GITHUB_ENV" | |
| echo "ARTIFACT_NAME=$NAME" >> "$GITHUB_ENV" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.ARTIFACT_NAME }} | |
| path: ${{ env.ARTIFACT_DIR }} | |
| publish: | |
| name: Publish release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - name: Flatten artifacts | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p release | |
| find dist -type f \( -name '*.tar.gz' -o -name '*.sha256' \) -exec cp {} release/ \; | |
| (cd release && sha256sum *.tar.gz > SHA256SUMS) | |
| ls -la release/ | |
| - name: Create GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: release/* | |
| fail_on_unmatched_files: true | |
| generate_release_notes: true |