name: Package on: push: tags: - "v*.*.*" branches: - main env: CARGO_INCREMENTAL: 0 CARGO_NET_RETRY: 10 CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 RUSTUP_MAX_RETRIES: 10 jobs: package: environment: packaging runs-on: macos-15 permissions: contents: write steps: - name: Install cargo-packager uses: taiki-e/cache-cargo-install-action@v2 with: tool: cargo-packager@0.11.8 - name: Install parse-changelog uses: taiki-e/cache-cargo-install-action@v2 with: tool: parse-changelog@0.6.14 - uses: actions/checkout@v4 with: persist-credentials: false # release-please normally parses the pull request description for release notes. # Instead of having two sources of truth, get them from the changelog. # # The workflow still isn't perfect because release-please can overwrite # the PR if new changes land, but it's good enough for now. - name: Parse changelog if: github.ref_type == 'tag' run: | GLIDE_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "glide-wm") | .version') parse-changelog CHANGELOG.md $GLIDE_VERSION > CHANGELOG_version.md - name: Install latest stable run: | rustup update stable rustup target add aarch64-apple-darwin rustup target add x86_64-apple-darwin - name: Build run: | cargo build --release --verbose --locked --target aarch64-apple-darwin cargo build --release --verbose --locked --target x86_64-apple-darwin - name: Import code-signing certificates uses: apple-actions/import-codesign-certs@v3 with: p12-file-base64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} p12-password: ${{ secrets.P12_PASSWORD }} - name: Import notarization API key if: github.ref_type == 'tag' env: APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }} run: | echo "$APPLE_API_KEY_BASE64" | base64 --decode > AuthKey.p8 - name: Package, sign, and notarize env: APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }} APPLE_API_KEY_PATH: AuthKey.p8 run: | if [[ "${{ github.ref_type }}" != "tag" ]]; then # Disable notarization. unset APPLE_API_KEY unset APPLE_API_ISSUER fi # For debugging; should show the signing identity security find-identity -v -p codesigning # HACK: Add --deep flag so codesign doesn't complain about signing # binaries in the wrong order (only on x86_64, wtf) mkdir -p ~/.bin cat <<'END' >~/.bin/codesign #!/bin/bash exec /usr/bin/codesign "$@" --deep END chmod +x ~/.bin/codesign export PATH=~/.bin:"$PATH" # Package, sign, and notarize cargo packager --release --target aarch64-apple-darwin cargo packager --release --target x86_64-apple-darwin - uses: actions/upload-artifact@v4 with: path: target/*-apple-darwin/release/Glide_*.dmg - name: Release uses: softprops/action-gh-release@v2 if: github.ref_type == 'tag' with: files: | target/aarch64-apple-darwin/release/Glide_*.dmg target/x86_64-apple-darwin/release/Glide_*.dmg fail_on_unmatched_files: true body_path: CHANGELOG_version.md # To keep release-please's notes, comment the line above and uncomment # these lines: # body: "" # append_body: true