diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..d1d0748 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,53 @@ +name: Publish + +on: + release: + types: [published] + +jobs: + publish: + name: Publish + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [22] + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.release.target_commitish }} + + - uses: pnpm/action-setup@v2.4.0 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + + - run: pnpm install + + - name: Test + run: pnpm test + + - name: Set up git + run: | + git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com' + git config --local user.name 'github-actions[bot]' + + - name: Bump version to ${{ github.event.release.tag_name }} + run: | + pnpm version ${{ github.event.release.tag_name }} + git add . + git commit -m "${{ github.event.release.tag_name }}" + + - name: Publish + env: + NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + pnpm config set //registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN} + pnpm publish --no-git-checks + + - name: Push changes + run: git push + env: + github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/package.json b/package.json index d876031..28c2878 100644 --- a/package.json +++ b/package.json @@ -71,5 +71,9 @@ "packageManager": "pnpm@9.4.0+sha512.f549b8a52c9d2b8536762f99c0722205efc5af913e77835dbccc3b0b0b2ca9e7dc8022b78062c17291c48e88749c70ce88eb5a74f1fa8c4bf5e18bb46c8bd83a", "engines": { "node": "18.x || >=20" + }, + "publishConfig": { + "provenance": true, + "access": "public" } }