From 00994272ea75f4c98abc70deb6466a49bfe1f230 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Tue, 3 Jun 2025 23:24:27 -0700 Subject: [PATCH] Release and publish on new version tags --- .github/workflows/release.yml | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e36f4e1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Release + +on: + push: + tags: + - "v*.*.*" + workflow_call: + secrets: + NPM_TOKEN: + required: true + +jobs: + release: + name: Release on GitHub + runs-on: ubuntu-24.04 + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - id: "generate-body" + run: | + { + echo 'BODY<> "$GITHUB_OUTPUT" + - run: echo ${{ steps.generate-body.outputs.BODY }} + - uses: softprops/action-gh-release@v2 + with: + body: ${{ steps.generate-body.outputs.BODY }} + + publish: + name: Publish to npm + runs-on: ubuntu-24.04 + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: actions/setup-node@v4 + with: + node-version-file: ".node-version" + registry-url: "https://registry.npmjs.org" + - run: npm ci + - run: npm publish --provenance --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} -- 2.47.3