From 8332bfe3eb848ffa7968d9cb1c08f5e29e0ae884 Mon Sep 17 00:00:00 2001 From: Grant Date: Thu, 4 Jun 2026 17:50:15 +0900 Subject: [PATCH] Add release workflow --- .github/workflows/release.yml | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 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..5121858 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,63 @@ +name: Release + +on: + push: + tags: + - 'v[0-9]*.[0-9]*.[0-9]*' + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + - uses: actions/setup-node@v6 + with: + node-version: '24' + package-manager-cache: false + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 + with: + version: 10 + run_install: false + - run: pnpm install --ignore-scripts + - run: pnpm run build + - uses: actions/upload-artifact@v7 + with: + name: dist + path: dist/ + retention-days: 1 + + publish: + needs: build + runs-on: ubuntu-latest + environment: release + permissions: + contents: write + id-token: write # Required for npm OIDC Trusted Publishing + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + - uses: actions/setup-node@v6 + with: + node-version: '24' + registry-url: 'https://registry.npmjs.org' + package-manager-cache: false + - uses: actions/download-artifact@v8 + with: + name: dist + path: dist/ + - run: npm publish --provenance --access public + - name: Create GitHub Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG_NAME: ${{ github.ref_name }} + run: | + PRERELEASE="" + if [[ "$TAG_NAME" == *"beta"* ]] || [[ "$TAG_NAME" == *"alpha"* ]]; then + PRERELEASE="--prerelease" + fi + gh release create "$TAG_NAME" --generate-notes $PRERELEASE