Workflow file for this run
This file contains 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
# This workflow publishes releases to upstream registries (crates.io | |
# for Rust crates, rubygems.org for Ruby gems). | |
# | |
# The release process is somewhat convoluted due to interdependencies | |
# between packages (most notably, Ruby gem requires eppo_core to be | |
# published beforehand and ruby-sdk/Cargo.lock to be updated with the | |
# proper hash), so we cannot release all packages in one go. | |
# | |
# To workaround these complications, the release process is staged and | |
# packages are released based on the release tag name. | |
# | |
# The following names are supported: | |
# - eppo_core@*.*.* to publish eppo_core to crates.io. | |
# - rust-sdk@*.*.* to publish Rust SDK. | |
# - ruby-sdk@*.*.* to publish Ruby SDK. | |
name: Publish Release | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
publish: | |
name: Publish to Crates.io | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref_name, 'eppo_core@') || startsWith(github.ref_name, 'rust-sdk@') }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- run: npm ci | |
- name: Install Rust toolchain | |
run: rustup update stable && rustup default stable | |
- name: Build Release | |
run: cargo build --release --verbose | |
- name: Test | |
run: cargo test --verbose | |
- name: Docs | |
run: cargo doc --verbose | |
- name: Publish eppo_core | |
if: ${{ startsWith(github.ref_name, 'eppo_core@') }} | |
run: cargo publish -p eppo_core | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | |
- name: Publish rust-sdk | |
if: ${{ startsWith(github.ref_name, 'rust-sdk@') }} | |
run: cargo publish -p eppo | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | |
publish_ruby: | |
name: Publish to RubyGems | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref_name, 'ruby-sdk@') }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.3' | |
- name: Check Cargo.lock | |
# Ensure that Cargo.lock matches Cargo.toml | |
run: cargo update --workspace --locked --verbose | |
working-directory: ruby-sdk | |
- name: Install dependencies | |
run: bundle install | |
working-directory: ruby-sdk | |
- name: Build | |
run: bundle exec rake build | |
working-directory: ruby-sdk | |
- name: Publish to RubyGems | |
run: | | |
mkdir -p $HOME/.gem | |
touch $HOME/.gem/credentials | |
chmod 0600 $HOME/.gem/credentials | |
printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials | |
gem push pkg/eppo-server-sdk-*.gem | |
env: | |
RUBYGEMS_API_KEY: "${{ secrets.RUBYGEMS_API_KEY }}" | |
working-directory: ruby-sdk |