diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..73a2b27 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: npm-publish + +on: + pull_request: + types: [closed] + branches: + - master + workflow_dispatch: {} + +jobs: + publish: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write # for npm provenance + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: 'https://registry.npmjs.org' + cache: 'pnpm' + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build + run: | + pnpm run --if-present release:build || pnpm run --if-present build + + - name: Test + run: pnpm run --if-present test + + - name: Publish with Changesets (pnpm) + run: pnpm run changeset:publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_CONFIG_PROVENANCE: true + +