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

on:
release:
types: [published]
workflow_dispatch:
inputs:
dry_run:
description: "Run without actually publishing"
type: boolean
default: true

permissions:
contents: read
id-token: write

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: dtolnay/rust-toolchain@stable

- name: Determine if dry run
id: mode
run: |
if [ "${{ github.event_name }}" = "release" ]; then
echo "dry_run=false" >> "$GITHUB_OUTPUT"
else
echo "dry_run=${{ inputs.dry_run }}" >> "$GITHUB_OUTPUT"
fi

- name: Verify version matches tag
if: ${{ steps.mode.outputs.dry_run == 'false' }}
run: |
TAG="${GITHUB_REF#refs/tags/v}"
CARGO_VER=$(grep '^version' host/Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
if [ "$TAG" != "$CARGO_VER" ]; then
echo "::error::Tag v$TAG does not match Cargo.toml version $CARGO_VER"
exit 1
fi

- name: Check crate not already published
run: |
CARGO_VER=$(grep '^version' host/Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
if curl -sf "https://crates.io/api/v1/crates/hyperlight-unikraft/$CARGO_VER" -H "User-Agent: hyperlight-unikraft" | jq -e .version > /dev/null 2>&1; then
echo "::warning::hyperlight-unikraft@$CARGO_VER already published"
echo "ALREADY_PUBLISHED=true" >> "$GITHUB_ENV"
fi

- name: Dry run (no auth needed)
if: ${{ steps.mode.outputs.dry_run == 'true' && env.ALREADY_PUBLISHED != 'true' }}
run: cargo publish --manifest-path host/Cargo.toml --dry-run

- name: Authenticate with crates.io
if: ${{ steps.mode.outputs.dry_run == 'false' && env.ALREADY_PUBLISHED != 'true' }}
uses: rust-lang/crates-io-auth-action@v1
id: crates-io-auth

- name: Publish hyperlight-unikraft
if: ${{ steps.mode.outputs.dry_run == 'false' && env.ALREADY_PUBLISHED != 'true' }}
run: cargo publish --manifest-path host/Cargo.toml
env:
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,14 @@ pillow/lxml/cryptography/dateutil/dotenv preloaded) behind a simple
`setup` / `run` workflow:

```bash
# Install pyhl from crates.io
cargo install hyperlight-unikraft --bin pyhl

# One-time: build the driver image (kernel + CPIO)
cd examples/python-agent-driver
just rootfs && just build
cd ../..

# Install pyhl
cargo install --git https://github.com/hyperlight-dev/hyperlight-unikraft \
hyperlight-unikraft-host --bin pyhl

# Point pyhl at the image you just built — creates ./.pyhl/ in cwd
pyhl setup --from examples/python-agent-driver

Expand Down
2 changes: 1 addition & 1 deletion demos/pptx-gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "PowerPoint generator using Hyperlight-Unikraft sandboxed Python e

[dependencies]
# Hyperlight-Unikraft library
hyperlight-unikraft = { path = "../../host", package = "hyperlight-unikraft-host" }
hyperlight-unikraft = { path = "../../host" }

# OpenAI API client
async-openai = "0.25"
Expand Down
4 changes: 2 additions & 2 deletions host/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions host/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
[package]
name = "hyperlight-unikraft-host"
version = "0.10.0"
name = "hyperlight-unikraft"
version = "0.11.0"
edition = "2021"
description = "Embedded Hyperlight host for running Unikraft unikernels"
license = "MIT OR Apache-2.0"
repository = "https://github.com/hyperlight-dev/hyperlight-unikraft"
homepage = "https://github.com/hyperlight-dev/hyperlight-unikraft"
keywords = ["hyperlight", "unikraft", "unikernel", "microvm", "sandbox"]
categories = ["virtualization"]
readme = "../README.md"
Comment thread
danbugs marked this conversation as resolved.

[lib]
name = "hyperlight_unikraft"
Expand Down
Loading