Create a Release #59
This file contains hidden or 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: Create a Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ release/**, main ] | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
benchmarks: | |
uses: ./.github/workflows/Benchmarks.yml | |
publish: | |
# see https://github.com/orgs/community/discussions/26286#discussioncomment-3251208 for why we need to check the ref | |
if: ${{ contains(github.ref, 'refs/heads/release/') }} || ${{ github.ref=='refs/heads/main' }} | |
needs: [ benchmarks ] | |
runs-on: ubuntu-latest | |
env: | |
PLATFORM: x64 | |
steps: | |
- name: Set Debug Configuration | |
if: ${{ github.ref=='refs/heads/main' }} | |
run: echo "CONFIG=debug" >> $GITHUB_ENV | |
- name: Set Release Configuration | |
if: ${{ contains(github.ref, 'refs/heads/release/') }} | |
run: echo "CONFIG=release" >> $GITHUB_ENV | |
- uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
# Ensures just is installed using setup wokflow to ensure just version consistency | |
- name: Hyperlight setup | |
uses: hyperlight-dev/[email protected] | |
with: | |
rust-toolchain: "1.86.0" | |
- name: Verify vendor.tar | |
if: ${{ contains(github.ref, 'refs/heads/release/') }} | |
run: | | |
set -euxo pipefail | |
VENDOR1=$(mktemp -d) | |
VENDOR2=$(mktemp -d) | |
tar xf ./src/hyperlight_wasm/vendor.tar -C $VENDOR1 | |
just make-vendor-tar | |
tar xf ./src/hyperlight_wasm/vendor.tar -C $VENDOR2 | |
if ! git diff --no-index $VENDOR1 $VENDOR2; then | |
echo "vendor.tar is not up to date, please run 'just make-vendor-tar' and commit the changes" | |
exit 1 | |
fi | |
git restore ./src/hyperlight_wasm/vendor.tar | |
shell: bash | |
- name: Package hyperlight-wasm crate | |
if: ${{ contains(github.ref, 'refs/heads/release/') }} | |
run: cargo package -p hyperlight-wasm | |
shell: bash | |
- name: Set HYPERLIGHTWASM_VERSION | |
run: | | |
git fetch --tags | |
version=$(echo "${{ github.ref }}" | sed -E 's#refs/heads/release/v##') | |
echo "HYPERLIGHTWASM_VERSION=$version" >> $GITHUB_ENV | |
echo "HYPERLIGHTWASM_VERSION=$version" | |
if: ${{ contains(github.ref, 'refs/heads/release/') }} | |
shell: bash | |
- name: Download Wasm Modules | |
uses: actions/download-artifact@v5 | |
with: | |
name: guest-modules | |
path: ${{ env.PLATFORM }}/${{ env.CONFIG }} | |
- name: Build rust wasm modules | |
run: just build-rust-wasm-examples ${{ env.CONFIG }} | |
shell: bash | |
- name: Download all benchmarks | |
uses: actions/download-artifact@v5 | |
with: | |
pattern: benchmarks_* | |
- name: Archive benchmarks | |
shell: bash | |
run: | | |
for BENCHMARK in benchmarks_*; do | |
tar -zcvf $BENCHMARK.tar.gz $BENCHMARK | |
done | |
- name: Create pre-release | |
if: ${{ github.ref=='refs/heads/main' }} | |
run: | | |
echo "PWD: $PWD" | |
ls -alR | |
gh release delete dev-latest -y --cleanup-tag || true | |
gh release create dev-latest -t "Latest Development Build From Dev Branch" --latest=false -p \ | |
benchmarks_*.tar.gz | |
env: | |
GH_TOKEN: ${{ github.token }} | |
shell: bash | |
- name: Create Release | |
if: ${{ contains(github.ref, 'refs/heads/release/') }} | |
run: | | |
echo "PWD: $PWD" | |
ls -alR | |
gh release create v${{ env.HYPERLIGHTWASM_VERSION }} -t "Release v${{ env.HYPERLIGHTWASM_VERSION }}" --generate-notes \ | |
benchmarks_*.tar.gz | |
env: | |
GH_TOKEN: ${{ github.token }} | |
shell: bash | |
- name: Publish dry-run | |
if: ${{ contains(github.ref, 'refs/heads/release/') }} | |
run: | | |
set -euxo pipefail | |
cargo publish -p hyperlight-wasm-aot --dry-run | |
cargo publish -p hyperlight-wasm --dry-run | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }} | |
shell: bash | |
- name: Publish to crates.io | |
if: ${{ contains(github.ref, 'refs/heads/release/') }} | |
run: | | |
set -euxo pipefail | |
cargo publish -p hyperlight-wasm-aot | |
cargo publish -p hyperlight-wasm | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }} | |
shell: bash |