[davey-node] Release to npm #7
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: "[davey-node] Release to npm" | |
| env: | |
| DEBUG: napi:* | |
| APP_NAME: davey | |
| MACOSX_DEPLOYMENT_TARGET: '10.13' | |
| CARGO_INCREMENTAL: '1' | |
| permissions: | |
| contents: write | |
| id-token: write | |
| 'on': | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Build and test | |
| uses: ./.github/workflows/node-ci.yml | |
| secrets: inherit | |
| publish: | |
| name: Publish | |
| needs: [test] | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: davey-node | |
| outputs: | |
| version: ${{ steps.set-version.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| package_json_file: ./davey-node/package.json | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| cache-dependency-path: ./davey-node/pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| path: ./davey-node/artifacts | |
| - name: Create npm dirs | |
| run: pnpm napi create-npm-dirs | |
| - name: Move artifacts | |
| run: pnpm artifacts | |
| - name: List packages | |
| run: ls -R ./npm | |
| shell: bash | |
| - name: Publish | |
| run: | | |
| npm config set provenance true | |
| echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc | |
| npm publish --access public | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Capture package version | |
| id: set-version | |
| shell: bash | |
| run: | | |
| VERSION=$(node -p 'require("./package.json").version') | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| release: | |
| name: Create release | |
| needs: [publish] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Generate a changelog | |
| uses: orhun/git-cliff-action@v4 | |
| id: git-cliff | |
| with: | |
| config: cliff.toml | |
| args: --unreleased --strip all --ignore-tags="(py|rs)-*" --include-path="./davey-node/**" --include-path="./davey/**" | |
| env: | |
| OUTPUT: davey-node/CHANGELOG.md | |
| GITHUB_REPO: ${{ github.repository }} | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: "js-${{ needs.publish.outputs.version }}" | |
| name: "davey-node@${{ needs.publish.outputs.version }}" | |
| target_commitish: ${{ github.sha }} | |
| body_path: davey-node/CHANGELOG.md |