diff --git a/Justfile b/Justfile index 8073a74..185b701 100644 --- a/Justfile +++ b/Justfile @@ -46,6 +46,29 @@ macos-dist-ruby: @echo "Built Ruby bundle:" @file dist/quicknode_sdk.bundle +# Build macOS arm64 artifacts locally and upload to an existing GitHub release. +# Usage: just macos-build-and-publish 0.2.0 +# Precondition: tag vX.Y.Z has been pushed and CI has published the release. +macos-build-and-publish version: + #!/usr/bin/env bash + set -euo pipefail + if ! gh release view "v{{version}}" >/dev/null 2>&1; then + echo "Error: release v{{version}} not found. Push the tag and let CI publish it first." >&2 + exit 1 + fi + # Clean dist/ so stale artifacts from a previous version's build don't get uploaded. + rm -rf dist + just macos-dist-python + just macos-dist-node + just macos-dist-ruby + # Stage the compiled bundle under ruby/lib so the platform gem picks it up, + # then build the arm64-darwin gem. + cp dist/quicknode_sdk.bundle ruby/lib/quicknode_sdk.bundle + cd ruby && ruby ../scripts/build-platform-gem.rb arm64-darwin lib/quicknode_sdk.bundle && gem build quicknode_sdk_platform.gemspec && rm quicknode_sdk_platform.gemspec && cd .. + mv ruby/*.gem dist/ + gh release upload "v{{version}}" dist/*.whl dist/index.darwin-arm64.node dist/*.gem --clobber + echo "Uploaded macOS arm64 artifacts to v{{version}}" + test: cargo test -p sdk-core --lib diff --git a/README.md b/README.md index b58edbf..8c6c003 100644 --- a/README.md +++ b/README.md @@ -3433,6 +3433,25 @@ QN_SDK__API_KEY=replaceme ruby ruby/examples/admin_e2e.rb QN_SDK__API_KEY=replaceme ruby ruby/examples/streams.rb ``` +### Releasing + +macOS (Apple Silicon) artifacts are built locally rather than on GitHub Actions to avoid the ~10× runner cost. Linux artifacts are still built by CI on tag push. + +```bash +# 1. Bump versions, commit, tag +just release 0.2.0 + +# 2. Push +git push && git push origin v0.2.0 + +# 3. Wait for CI to finish and publish the GitHub release with Linux artifacts. + +# 4. Build macOS arm64 artifacts locally and append them to the release +just macos-build-and-publish 0.2.0 +``` + +Step 4 requires the [`gh` CLI](https://cli.github.com/) authenticated to the repo. Intel macOS (`x86_64-apple-darwin`) is not shipped — users on Intel Macs install from source. + ## License MIT diff --git a/scripts/build-platform-gem.rb b/scripts/build-platform-gem.rb new file mode 100755 index 0000000..7ea923e --- /dev/null +++ b/scripts/build-platform-gem.rb @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby +# Writes a temporary platform-specific gemspec (quicknode_sdk_platform.gemspec) +# that includes a prebuilt native library. Run from the ruby/ directory. +# +# Usage: ruby ../scripts/build-platform-gem.rb +# Example: ruby ../scripts/build-platform-gem.rb arm64-darwin lib/quicknode_sdk.bundle + +platform, lib_file = ARGV +abort "Usage: build-platform-gem.rb " unless platform && lib_file + +spec = Gem::Specification.load('quicknode_sdk.gemspec') +spec.platform = Gem::Platform.new(platform) +spec.extensions = [] +spec.files += [lib_file] +File.write('quicknode_sdk_platform.gemspec', spec.to_ruby)