]> git.ardis.lu - csvio/commitdiff
Release and publish on new version tags
authorArdis Lu <ardisglu@gmail.com>
Wed, 4 Jun 2025 06:24:27 +0000 (23:24 -0700)
committerArdis Lu <ardisglu@gmail.com>
Wed, 4 Jun 2025 06:24:27 +0000 (23:24 -0700)
.github/workflows/release.yml [new file with mode: 0644]

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644 (file)
index 0000000..e36f4e1
--- /dev/null
@@ -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<<EOF'
+            git tag -l --format='%(contents:subject)%0a%0a%(contents:body)' ${{ github.ref_name }}
+            echo 'EOF'
+          } >> "$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 }}
This page took 0.036014 seconds and 4 git commands to generate.