Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ name: release
on:
release:
types: [published]
# release-tag workflow は GITHUB_TOKEN で GitHub release を作成するが、
# GITHUB_TOKEN が起こしたイベントは他の workflow をトリガーしない仕様の
# ため、上の release: published では起動しない。手動で publish できるよう
# workflow_dispatch を用意している。
workflow_dispatch:

jobs:
publish:
Expand All @@ -13,7 +18,12 @@ jobs:
id-token: write

steps:
# release イベントはタグを、workflow_dispatch は実行対象ブランチ
# (通常は main) をチェックアウトする。publish するバージョンは
# どちらの場合もチェックアウトした package.json から取得する。
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.release.tag_name || github.ref }}
- name: Setup Node.js 24.x
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
Expand All @@ -27,10 +37,6 @@ jobs:
- run: pnpm run fmt:check
- run: pnpm run test
- run: pnpm run build
- name: Sync package.json version with release tag
run: |
VERSION="${GITHUB_REF_NAME#v}"
npm version "$VERSION" --no-git-tag-version --allow-same-version
- name: Publish to npm
if: github.event.release.prerelease == false
if: github.event_name == 'workflow_dispatch' || github.event.release.prerelease == false
run: npm publish --provenance --access public