chore(release): prepare 0.10.0 #38
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
| name: Release prebuilt npm packages | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| publish: | |
| description: Publish the staged prebuilt packages to npm | |
| required: true | |
| default: false | |
| type: boolean | |
| npm_tag: | |
| description: npm dist-tag to publish under (for example latest or beta) | |
| required: true | |
| default: latest | |
| type: string | |
| push: | |
| tags: | |
| - "v*" | |
| env: | |
| SKIP_INSTALL_SIMPLE_GIT_HOOKS: "1" | |
| concurrency: | |
| group: release-prebuilt-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| build-binaries: | |
| name: Build ${{ matrix.package_name }} | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - package_name: hunkdiff-linux-arm64 | |
| runner: ubuntu-24.04-arm | |
| - package_name: hunkdiff-linux-x64 | |
| runner: ubuntu-latest | |
| - package_name: hunkdiff-darwin-x64 | |
| runner: macos-15-intel | |
| - package_name: hunkdiff-darwin-arm64 | |
| runner: macos-14 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.10 | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Build host artifact | |
| run: | | |
| bun run build:bin | |
| bun run ./scripts/build-prebuilt-artifact.ts --expect-package "${{ matrix.package_name }}" | |
| - name: Upload binary artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.package_name }} | |
| path: dist/release/artifacts/${{ matrix.package_name }} | |
| if-no-files-found: error | |
| stage-release: | |
| name: Stage prebuilt npm release | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build-binaries | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.10 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Verify tag matches package version | |
| if: github.event_name == 'push' | |
| run: bun run ./scripts/check-release-version.ts "${{ github.ref_name }}" | |
| - name: Download platform artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist/release/artifacts | |
| - name: Show downloaded artifacts | |
| run: find dist/release/artifacts -maxdepth 3 -type f | sort | |
| - name: Stage npm release directories | |
| run: bun run stage:prebuilt:release | |
| - name: Verify staged packages | |
| run: bun run check:prebuilt-pack | |
| - name: Smoke test staged install | |
| run: bun run smoke:prebuilt-install | |
| - name: Dry-run npm publish order | |
| run: bun run publish:prebuilt:npm -- --dry-run --tag "${{ github.event_name == 'workflow_dispatch' && inputs.npm_tag || ((contains(github.ref_name, '-alpha') || contains(github.ref_name, '-beta') || contains(github.ref_name, '-rc')) && 'beta' || 'latest') }}" | |
| - name: Upload staged npm release | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: staged-prebuilt-npm-release | |
| path: dist/release/npm | |
| if-no-files-found: error | |
| publish: | |
| name: Publish prebuilt npm release | |
| runs-on: ubuntu-latest | |
| needs: | |
| - stage-release | |
| if: github.event_name == 'push' || inputs.publish == true | |
| environment: npm | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.10 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| registry-url: https://registry.npmjs.org | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Download staged npm release | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: staged-prebuilt-npm-release | |
| path: dist/release/npm | |
| - name: Show staged packages | |
| run: find dist/release/npm -maxdepth 3 -type f | sort | |
| - name: Verify npm auth | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: npm whoami | |
| - name: Publish packages | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: bun run publish:prebuilt:npm -- --tag "${{ github.event_name == 'workflow_dispatch' && inputs.npm_tag || ((contains(github.ref_name, '-alpha') || contains(github.ref_name, '-beta') || contains(github.ref_name, '-rc')) && 'beta' || 'latest') }}" | |
| create-github-release: | |
| name: Create GitHub release | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build-binaries | |
| - publish | |
| if: github.event_name == 'push' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Download platform artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist/release/artifacts | |
| - name: Archive release assets | |
| run: | | |
| mkdir -p dist/release/github | |
| while IFS= read -r -d '' directory; do | |
| package_name="$(basename "$directory")" | |
| tar -C "$(dirname "$directory")" -czf "dist/release/github/${package_name}.tar.gz" "$package_name" | |
| done < <(find dist/release/artifacts -mindepth 1 -maxdepth 1 -type d -print0 | sort -z) | |
| find dist/release/github -maxdepth 1 -type f | sort | |
| - name: Create or update GitHub release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| TAG_NAME: ${{ github.ref_name }} | |
| run: | | |
| prerelease_args=() | |
| case "$TAG_NAME" in | |
| *-alpha*|*-beta*|*-rc*) | |
| prerelease_args+=(--prerelease) | |
| ;; | |
| esac | |
| if gh release view "$TAG_NAME" >/dev/null 2>&1; then | |
| gh release upload "$TAG_NAME" dist/release/github/* --clobber | |
| else | |
| gh release create "$TAG_NAME" \ | |
| --title "$TAG_NAME" \ | |
| --generate-notes \ | |
| "${prerelease_args[@]}" \ | |
| dist/release/github/* | |
| fi |