Publish crates to crates.io #3
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Publish crates to crates.io | |
on: | |
workflow_dispatch: | |
inputs: | |
dry_run: | |
description: "Run the release without actually releasing bits" | |
type: boolean | |
default: true | |
workflow_call: | |
inputs: | |
dry_run: | |
description: "Run the release without actually releasing bits" | |
type: boolean | |
default: true | |
permissions: | |
contents: read | |
id-token: write | |
jobs: | |
publish-hyperlight-packages: | |
runs-on: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"] | |
if: ${{ startsWith(github.ref, 'refs/heads/release/v') || inputs.dry_run }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- uses: hyperlight-dev/[email protected] | |
with: | |
rust-toolchain: "1.81.0" | |
- name: Check crate versions | |
shell: bash | |
run: | | |
if ${{ inputs.dry_run }}; then | |
VERSION="" | |
else | |
VERSION="${{ github.ref }}" | |
VERSION="${VERSION#refs/heads/release/v}" | |
fi | |
./dev/verify-version.sh "$VERSION" hyperlight-common hyperlight-guest hyperlight-host | |
- name: Publish hyperlight-common | |
continue-on-error: ${{ inputs.dry_run }} | |
run: cargo publish --manifest-path ./src/hyperlight_common/Cargo.toml ${{ inputs.dry_run && '--dry-run' || '' }} | |
- name: Publish hyperlight-guest | |
continue-on-error: ${{ inputs.dry_run }} | |
run: cargo publish --manifest-path ./src/hyperlight_guest/Cargo.toml ${{ inputs.dry_run && '--dry-run' || '' }} | |
- name: Publish hyperlight-host | |
continue-on-error: ${{ inputs.dry_run }} | |
run: cargo publish --manifest-path ./src/hyperlight_host/Cargo.toml ${{ inputs.dry_run && '--dry-run' || '' }} | |
# TODO: Do we want to publish hyperlight-guest-capi to crates.io given that it's not for Rust consumption? | |
# - name: Publish hyperlight-guest-capi | |
# # `--no-verify` is needed because build.rs writes to "include/hyperlight_guest.h", but since we exclude that directory in Cargo.toml, it should be fine. | |
# # Cargo does not want you to modify files outside of OUT_DIR | |
# run: cd ./src/hyperlight_guest_capi && cargo publish --no-verify ${{ inputs.dry_run && '--dry-run' || '' }} # cd is required because of https://github.com/rust-lang/cargo/issues/10302 |