From 972caa2b5cfd412b27d2e44b4a8fdbdb7c135ff6 Mon Sep 17 00:00:00 2001 From: tomoemon Date: Sun, 17 May 2026 16:25:37 +0900 Subject: [PATCH] =?UTF-8?q?ci:=20stackblitz=20=E6=9B=B4=E6=96=B0=E3=82=92?= =?UTF-8?q?=20release-tag=20workflow=20=E3=81=AE=E5=BE=8C=E7=B6=9A?= =?UTF-8?q?=E3=82=B8=E3=83=A7=E3=83=96=E3=81=AB=E7=B5=B1=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- .github/workflows/release-tag.yaml | 35 +++++++++++++++++++++++++++--- .github/workflows/stackblitz.yaml | 32 --------------------------- 2 files changed, 32 insertions(+), 35 deletions(-) delete mode 100644 .github/workflows/stackblitz.yaml diff --git a/.github/workflows/release-tag.yaml b/.github/workflows/release-tag.yaml index cab82e7..53c669a 100644 --- a/.github/workflows/release-tag.yaml +++ b/.github/workflows/release-tag.yaml @@ -38,11 +38,13 @@ jobs: git push origin "v$VERSION" gh release create "v$VERSION" --title "v$VERSION" --generate-notes + # GITHUB_TOKEN が起こした release イベントは別 workflow をトリガーしない + # ため、release 後に走らせたい処理 (publish / stackblitz 更新) はいずれも + # 別 workflow ではなく同一 workflow の後続ジョブとして実行する。 + publish: needs: release-tag - # 新しいタグを作成した場合のみ publish する。GITHUB_TOKEN が起こした - # release イベントは別 workflow をトリガーしないため、publish は別 - # workflow ではなく同一 workflow の後続ジョブとして実行する。 + # 新しいタグを作成した場合のみ publish する。 if: needs.release-tag.outputs.created == 'true' runs-on: ubuntu-latest permissions: @@ -65,3 +67,30 @@ jobs: - run: pnpm run build - name: Publish to npm run: npm publish --provenance --access public + + update-stackblitz: + needs: release-tag + # 新しいタグを作成した場合のみ stackblitz 用ブランチを更新する。 + if: needs.release-tag.outputs.created == 'true' + runs-on: ubuntu-latest + permissions: + contents: write + env: + VERSION: ${{ needs.release-tag.outputs.version }} + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - name: Update examples package.json + run: | + for pkg in examples/*/package.json; do + sed -i 's/"emiel": "workspace:\*"/"emiel": "^'"$VERSION"'"/' "$pkg" + done + - name: Remove pnpm-lock.yaml from examples + run: find examples -maxdepth 2 -name "pnpm-lock.yaml" -delete + - name: Push to stackblitz branch + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git checkout -B stackblitz + git add examples/ + git commit -m "chore: prepare examples for stackblitz (v$VERSION)" + git push origin stackblitz --force diff --git a/.github/workflows/stackblitz.yaml b/.github/workflows/stackblitz.yaml deleted file mode 100644 index 99efbc3..0000000 --- a/.github/workflows/stackblitz.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: update-stackblitz - -on: - release: - types: [published] - -jobs: - update-stackblitz: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Get version - id: version - run: echo "value=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" - - name: Update examples package.json - run: | - VERSION="${{ steps.version.outputs.value }}" - for pkg in examples/*/package.json; do - sed -i 's/"emiel": "workspace:\*"/"emiel": "^'"$VERSION"'"/' "$pkg" - done - - name: Remove pnpm-lock.yaml from examples - run: find examples -maxdepth 2 -name "pnpm-lock.yaml" -delete - - name: Push to stackblitz branch - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git checkout -B stackblitz - git add examples/ - git commit -m "chore: prepare examples for stackblitz (v${{ steps.version.outputs.value }})" - git push origin stackblitz --force