do not install gh in CI (#92) #3
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: windows-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@v4 | |
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.85.0" | |
- name: Verify vendor.tar | |
if: ${{ contains(github.ref, 'refs/heads/release/') }} | |
run: | | |
mv ./src/hyperlight_wasm/vendor.tar ./vendor.tar | |
just make-vendor-tar | |
if ! git diff --no-index ./vendor.tar ./src/hyperlight_wasm/vendor.tar; then | |
echo "vendor.tar is not up to date, please run 'just make-vendor-tar' and commit the changes" | |
exit 1 | |
fi | |
shell: bash | |
- name: Package hyperlight-wasm crate | |
if: ${{ contains(github.ref, 'refs/heads/release/') }} | |
run: cargo package -p hyperlight-wasm | |
shell: bash | |
- name: Install minver_rs | |
run: | | |
cargo install minver_rs | |
shell: pwsh | |
- name: Set HYPERLIGHTWASM_VERSION | |
run: | | |
git fetch --tags || true | |
$env:MINVER_TAG_PREFIX="v" | |
$env:MINVER_AUTO_INCREMENT_LEVEL="Minor" | |
$env:MINVER_PRERELEASE_IDENTIFIER="preview" | |
echo "HYPERLIGHTWASM_VERSION=$(minver)"| Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
echo "HYPERLIGHTWASM_VERSION=$(minver)" | |
shell: pwsh | |
- name: Download Wasm Modules | |
uses: actions/download-artifact@v4 | |
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 Benchmarks (Windows) | |
uses: actions/download-artifact@v4 | |
with: | |
name: benchmarks_Windows_whp | |
path: benchmarks_Windows_whp | |
- name: Download Benchmarks (Linux hyperv) | |
uses: actions/download-artifact@v4 | |
with: | |
name: benchmarks_Linux_hyperv | |
path: benchmarks_Linux_hyperv | |
- name: Download Benchmarks (Linux kvm) | |
uses: actions/download-artifact@v4 | |
with: | |
name: benchmarks_Linux_kvm | |
path: benchmarks_Linux_kvm | |
- name: Archive benchmarks | |
run: | | |
tar -zcvf benchmarks_Windows_whp.tar.gz benchmarks_Windows_whp | |
tar -zcvf benchmarks_Linux_hyperv.tar.gz benchmarks_Linux_hyperv | |
tar -zcvf benchmarks_Linux_kvm.tar.gz benchmarks_Linux_kvm | |
- name: Install github-cli | |
run: | | |
$ProgressPreference = 'SilentlyContinue' | |
# check if gh cli is installed | |
$installed = [bool](Get-Command -ErrorAction Ignore -Type Application gh) | |
if ($installed) { Write-Host "gh cli already installed"; exit 0 } | |
# download and install gh cli | |
Invoke-WebRequest https://github.com/cli/cli/releases/download/v2.50.0/gh_2.50.0_windows_amd64.msi -OutFile gh.msi | |
msiexec.exe /i gh.msi /quiet /l log.txt | Out-Null | |
Write-Host "msiexec exited with code $LASTEXITCCODE" | |
if ($LASTEXITCODE -ne 0) { cat log.txt; exit 1 } | |
- 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_Windows_whp.tar.gz \ | |
benchmarks_Linux_hyperv.tar.gz \ | |
benchmarks_Linux_kvm.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_Windows_whp.tar.gz \ | |
benchmarks_Linux_hyperv.tar.gz \ | |
benchmarks_Linux_kvm.tar.gz | |
env: | |
GH_TOKEN: ${{ github.token }} | |
shell: bash | |
- name: Publish to crates.io | |
if: ${{ contains(github.ref, 'refs/heads/release/') }} | |
run: cargo publish hyperlight-wasm | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }} | |
shell: bash |