Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish canbench crates to crates.io

on:
workflow_dispatch:
inputs:
dryRun:
description: "Run cargo publish with --dry-run"
required: false
type: boolean

jobs:
publish-canbench:
runs-on: ubuntu-latest

permissions:
id-token: write # Required for OIDC token exchange

steps:
- uses: actions/checkout@v5

- uses: rust-lang/crates-io-auth-action@v1
id: auth

- run: echo "Preparing to cargo publish ${{ github.ref_name }}."
# Crates need to be published in this specific order
- run: cargo publish -p canbench-rs-macros ${{ inputs.dryRun == true && '--dry-run' || '' }}
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

- run: cargo publish -p canbench-rs ${{ inputs.dryRun == true && '--dry-run' || '' }}
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

- run: cargo publish -p canbench ${{ inputs.dryRun == true && '--dry-run' || '' }}
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

- name: Post to a Slack channel
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
with:
channel-id: eng-dsm-alerts
slack-message: "${{ inputs.dryRun == true && 'DRY RUN: ' || '' }}New `canbench` crates (version `${{ github.ref_name }}`) has been published to crates.io"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_API_TOKEN }}
11 changes: 3 additions & 8 deletions development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ Here's an example PR bumping the versions: https://github.com/dfinity/canbench/p

## Steps to Publish the Packages to crates.io

1. Generate an API token to use with crates.io:
Log in to crates.io with your GitHub account, go to **Account Settings**, and generate a new token under **API Tokens**.
2. Run `cargo login` in the terminal and enter your API key when prompted.
3. Check out the repo at the tag created for the release, e.g. `git checkout vX.X.X`.
4. Publish the crates in the following order:
- `cargo publish -p canbench-rs-macros`
- `cargo publish -p canbench-rs`
- `cargo publish -p canbench`
1. On the repository main page, navigate to the `Actions` tab.
2. Click on the workflow to publish to crates.io
3. Click on `run workflow` and select the version tag created above for the workflow to run on.