Skip to content

feat(js-host-api): add npm publishing workflow (#36) #65

feat(js-host-api): add npm publishing workflow (#36)

feat(js-host-api): add npm publishing workflow (#36) #65

Workflow file for this run

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Create a Release
on:
workflow_dispatch:
push:
branches: [main]
permissions:
id-token: write
contents: write # needed to create a release
jobs:
build:
uses: ./.github/workflows/dep_build.yml
secrets: inherit
with:
environment: release
benchmarks:
uses: ./.github/workflows/dep_benchmarks.yml
secrets: inherit
with:
download-benchmarks: true
upload-benchmarks: true
environment: release
publish-hyperlight-js-packages-and-create-release:
needs: [build, benchmarks]
environment: release
runs-on: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd", "JobId=publish-hyperlight-js-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}"]
if: ${{ contains(github.ref, 'refs/heads/release/') }}
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
# Ensures just is installed using setup wokflow to ensure just version consistency
- name: Hyperlight setup
uses: hyperlight-dev/[email protected]
with:
rust-toolchain: "1.89"
- name: Authenticate with crates.io
uses: rust-lang/crates-io-auth-action@v1
id: crates-io-auth
- name: Set crate versions
id: set-version
run: |
git fetch --tags || true
version=$(echo "${{ github.ref }}" | sed -E 's#refs/heads/release/v##')
echo "Setting version to 'v$version'"
echo "HYPERLIGHT_JS_VERSION=v$version" >> $GITHUB_ENV
echo "version=$version" >> $GITHUB_OUTPUT
- name: Publish hyperlight-js
run: |
cargo publish -p hyperlight-js-runtime
cargo publish -p hyperlight-js
env:
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
- name: Download benchmarks (Windows)
uses: actions/download-artifact@v8
with:
name: benchmarks_Windows_whp
path: benchmarks_Windows_whp
- name: Download benchmarks (Linux kvm)
uses: actions/download-artifact@v8
with:
name: benchmarks_Linux_kvm
path: benchmarks_Linux_kvm
- name: Download benchmarks (Linux hyperv3)
uses: actions/download-artifact@v8
with:
name: benchmarks_Linux_hyperv3
path: benchmarks_Linux_hyperv3
- name: Archive benchmarks
run: |
tar -zcvf benchmarks_Windows_whp.tar.gz benchmarks_Windows_whp
tar -zcvf benchmarks_Linux_kvm.tar.gz benchmarks_Linux_kvm
tar -zcvf benchmarks_Linux_hyperv3.tar.gz benchmarks_Linux_hyperv3
- name: Create GH Release
run: |
gh release create ${{ env.HYPERLIGHT_JS_VERSION }} \
--generate-notes \
benchmarks_Windows_whp.tar.gz \
benchmarks_Linux_kvm.tar.gz \
benchmarks_Linux_hyperv3.tar.gz
env:
GH_TOKEN: ${{ github.token }}
publish-npm-packages:
needs: [publish-hyperlight-js-packages-and-create-release]
if: ${{ contains(github.ref, 'refs/heads/release/') }}
uses: ./.github/workflows/npm-publish.yml

Check failure on line 105 in .github/workflows/CreateRelease.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/CreateRelease.yml

Invalid workflow file

error parsing called workflow ".github/workflows/CreateRelease.yml" -> "./.github/workflows/npm-publish.yml" (source branch with sha:ad92d57498d110c4ab8d9a6c0d9f1facaa6656d3) : You have an error in your yaml syntax on line 120
with:
version: ${{ needs.publish-hyperlight-js-packages-and-create-release.outputs.version }}
dry-run: false
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}