Skip to content
Open
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
59 changes: 59 additions & 0 deletions .github/workflows/publish-ic-vetkeys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Publish ic-vetkeys to crates.io

env:
CRATE_NAME: ic-vetkeys

on:
workflow_dispatch:
inputs:
crate-version:
description: 'The version of the crate to publish'
required: true
dry-run:
description: "If true, run publish in dry-run mode (don't actually publish the crate)"
required: false
default: false
type: boolean

run-name: >-
${{ format('Publish ${{ env.CRATE_NAME }} {0} to crates.io', github.event.inputs.crate-version) }}

permissions:
contents: read
id-token: write

jobs:
publish-crates:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

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

- name: Check crate version
run: |
set -euo pipefail
crate_name="${{ env.CRATE_NAME }}"
crate_version="${{ github.event.inputs.crate-version }}"

current_crate_version=$(cargo metadata --no-deps --format-version 1 | jq -r ".packages[] | select(.name==\"${crate_name}\") | .version")
if [ "$current_crate_version" != "$crate_version" ]; then
echo "Crate version mismatch: expected $crate_version, found $current_crate_version"
exit 1
fi

- name: Build and Test crate
run: |
cargo build --package ${{ env.CRATE_NAME }}
cargo test --package ${{ env.CRATE_NAME }}

- name: Publish dry run
if: ${{ github.event.inputs.dry-run == 'true' }}
run: cargo publish --package ${{ env.CRATE_NAME }} --dry-run

- name: Publish crate
if: ${{ github.event.inputs.dry-run == 'false' }}
run: cargo publish --package ${{ env.CRATE_NAME }}
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
Loading