v0.1.2 #3
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: Publish | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to publish (e.g., 0.1.0)" | |
| required: true | |
| type: string | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| # Test on all hypervisor configurations before publishing | |
| # NOTE: Windows WHP temporarily disabled (see pr-validate.yml) | |
| test: | |
| name: Test (${{ matrix.hypervisor }}) | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| build: [linux-kvm, linux-mshv] | |
| include: | |
| - build: linux-kvm | |
| os: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"] | |
| hypervisor: kvm | |
| - build: linux-mshv | |
| os: [self-hosted, Linux, X64, "1ES.Pool=hld-azlinux3-mshv-amd"] | |
| hypervisor: mshv | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "22" | |
| - uses: hyperlight-dev/ci-setup-workflow@v1.8.0 | |
| with: | |
| rust-toolchain: "1.89" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup | |
| run: just setup | |
| - name: Build release binary | |
| run: node scripts/build-binary.js --release | |
| - name: Run tests | |
| run: just test | |
| # Build and publish npm package (after tests pass) | |
| publish-npm: | |
| name: Publish to npmjs.org | |
| needs: [test] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "22" | |
| registry-url: "https://registry.npmjs.org" | |
| - uses: hyperlight-dev/ci-setup-workflow@v1.8.0 | |
| with: | |
| rust-toolchain: "1.89" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup | |
| run: just setup | |
| - name: Build binary | |
| run: VERSION="${{ github.event.release.tag_name || inputs.version }}" node scripts/build-binary.js --release | |
| - name: Set version from release tag | |
| if: github.event_name == 'release' | |
| run: npm version ${{ github.event.release.tag_name }} --no-git-tag-version --allow-same-version | |
| - name: Set version from input | |
| if: github.event_name == 'workflow_dispatch' | |
| run: npm version ${{ inputs.version }} --no-git-tag-version --allow-same-version | |
| - name: Publish to npmjs.org | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| # Build and publish Docker image (after tests pass) | |
| publish-docker: | |
| name: Publish to GitHub Container Registry | |
| needs: [test] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "22" | |
| - uses: hyperlight-dev/ci-setup-workflow@v1.8.0 | |
| with: | |
| rust-toolchain: "1.89" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup | |
| run: just setup | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| VERSION=${{ github.event.release.tag_name || inputs.version }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |