chore(deps): update all non-major dependencies #432
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
| name: Test Libvirt | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| steps: | |
| - uses: googleapis/release-please-action@v4 | |
| if: github.ref == 'refs/heads/main' | |
| id: release | |
| with: | |
| release-type: node | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: [release-please] | |
| # Run on all PRs, or when a release is created | |
| if: ${{ github.event_name == 'pull_request' || needs.release-please.outputs.release_created }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| - name: Cache APT Packages | |
| uses: awalsh128/cache-apt-pkgs-action@v1.6.0 | |
| with: | |
| packages: libvirt-dev qemu-system qemu-user-static | |
| version: 1.0 | |
| - name: Set Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: ".nvmrc" | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Get pnpm store directory | |
| id: pnpm-cache | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
| - uses: actions/cache@v4 | |
| name: Setup pnpm cache | |
| with: | |
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('package.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: pnpm install | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: pnpm run build | |
| - name: Setup NPM Authentication | |
| if: ${{ needs.release-please.outputs.release_created }} | |
| run: | | |
| echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
| - name: Publish to NPM | |
| if: ${{ needs.release-please.outputs.release_created }} | |
| run: pnpm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| prebuild: | |
| name: Build and (Possibly) Publish Pre-built Binaries | |
| needs: [release-please] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| node-version: [18, 22] # 18 is required for cloudflare workers | |
| arch: [amd64, arm64] | |
| os: [ubuntu-latest, macos-latest] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ needs.release-please.outputs.tag_name }} | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| - name: Set Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Get pnpm store directory | |
| id: pnpm-cache | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
| - name: Install build dependencies | |
| run: | | |
| case "${{ matrix.os }}" in | |
| ubuntu*) sudo apt-get update && sudo apt-get install -y libvirt-dev ;; | |
| macos*) brew install libvirt ;; | |
| esac | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build native module | |
| run: pnpm build/native | |
| - name: Set file naming variables | |
| id: filename-vars | |
| shell: bash | |
| run: | | |
| # Normalize OS name | |
| case "${{ matrix.os }}" in | |
| ubuntu*) PLATFORM="linux" ;; | |
| macos*) PLATFORM="darwin" ;; | |
| *) PLATFORM="${{ matrix.os }}" ;; | |
| esac | |
| # Normalize architecture | |
| case "${{ matrix.arch }}" in | |
| amd64) ARCH_NAME="x64" ;; | |
| arm64) ARCH_NAME="arm64" ;; | |
| *) ARCH_NAME="${{ matrix.arch }}" ;; | |
| esac | |
| # Get Node.js ABI version | |
| NODE_ABI=$(node -e "console.log(process.versions.modules)") | |
| # Construct filename | |
| FILENAME="libvirt-${{ needs.release-please.outputs.tag_name }}-node-v${NODE_ABI}-${PLATFORM}-${ARCH_NAME}.tar.gz" | |
| echo "FILENAME=$FILENAME" >> $GITHUB_OUTPUT | |
| - name: Package binary | |
| run: | | |
| mkdir -p deploy | |
| cd ${{ github.workspace }}/build/Release | |
| tar -czf ${{ github.workspace }}/deploy/${{ steps.filename-vars.outputs.FILENAME }} . | |
| - name: Validate tarball | |
| run: | | |
| tar -tf ${{ github.workspace }}/deploy/${{ steps.filename-vars.outputs.FILENAME }} | |
| - name: Upload Release Assets | |
| if: ${{ needs.release-please.outputs.release_created }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| echo "Uploading ${{ steps.filename-vars.outputs.FILENAME }} to release..." | |
| gh release upload "${{ needs.release-please.outputs.tag_name }}" "deploy/${{ steps.filename-vars.outputs.FILENAME }}" --clobber |