Create a Release #137
Workflow file for this run
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: [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 | |
| set-version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.set-version.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Set version | |
| id: set-version | |
| shell: bash | |
| run: | | |
| git fetch --tags || true | |
| # Extract the version number from the branch name, which is expected to be in the format 'release/vX.Y.Z' | |
| # if not, default to '0.0.0' to avoid errors in subsequent steps | |
| if [[ "${GITHUB_REF}" =~ refs/heads/release/v([0-9]+\.[0-9]+\.[0-9]+) ]]; then | |
| version="${BASH_REMATCH[1]}" | |
| else | |
| version="0.0.0" | |
| fi | |
| echo "Setting version to 'v$version'" | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| publish-hyperlight-js-packages-and-create-release: | |
| needs: [build, benchmarks, set-version] | |
| 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/') }} | |
| 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/ci-setup-workflow@v1.9.0 | |
| with: | |
| rust-toolchain: "1.89" | |
| just-version: "1.51" | |
| - name: Authenticate with crates.io | |
| uses: rust-lang/crates-io-auth-action@v1 | |
| id: crates-io-auth | |
| - 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 ${{ needs.set-version.outputs.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: [set-version] | |
| uses: ./.github/workflows/npm-publish.yml | |
| with: | |
| version: ${{ needs.set-version.outputs.version }} | |
| dry-run: ${{ !contains(github.ref, 'refs/heads/release/') }} |