release #23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: release | |
| # d-party モノレポ root の release ワークフローから統一バージョンを受け取って起動される。 | |
| # 旧 bump_type 方式は廃止し、version を外部入力で受け取る。 | |
| # build + Chrome Web Store への公開は従来どおりここで行う。 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Release version (X.Y.Z)" | |
| required: true | |
| type: string | |
| release_note: | |
| description: "Release notes (optional)" | |
| required: false | |
| type: string | |
| publish: | |
| description: "Publish to Chrome Web Store (false = upload only; publish manually in the dashboard)" | |
| required: false | |
| type: boolean | |
| default: false | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Set version | |
| id: version | |
| env: | |
| VERSION_NUM: ${{ inputs.version }} | |
| run: | | |
| echo "new_version=v${VERSION_NUM}" >> "$GITHUB_OUTPUT" | |
| echo "version_num=${VERSION_NUM}" >> "$GITHUB_OUTPUT" | |
| node -e "const fs=require('fs');const p=JSON.parse(fs.readFileSync('package.json','utf8'));p.version=process.env.VERSION_NUM;fs.writeFileSync('package.json',JSON.stringify(p,null,2)+'\n');" | |
| node -e "const fs=require('fs');const m=JSON.parse(fs.readFileSync('public/manifest.json','utf8'));m.version=process.env.VERSION_NUM;fs.writeFileSync('public/manifest.json',JSON.stringify(m,null,2)+'\n');" | |
| - name: Commit and push version bump | |
| run: | | |
| set -euo pipefail | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add package.json public/manifest.json | |
| if git diff --cached --quiet; then | |
| echo "version files already at ${{ steps.version.outputs.new_version }}; skipping bump commit" | |
| else | |
| git commit -m "chore: bump version to ${{ steps.version.outputs.new_version }} [skip ci]" | |
| git push origin HEAD:main | |
| fi | |
| - name: Force-update release tag | |
| run: | | |
| set -euo pipefail | |
| git tag -f "${{ steps.version.outputs.new_version }}" | |
| git push origin "refs/tags/${{ steps.version.outputs.new_version }}" --force | |
| - name: Generate API client | |
| run: pnpm api:generate | |
| - name: Build extension | |
| run: pnpm build:prod | |
| - name: Package extension | |
| run: | | |
| cd dist | |
| zip -r "../d-party_${{ steps.version.outputs.new_version }}.zip" . | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.new_version }} | |
| name: Release ${{ steps.version.outputs.new_version }} | |
| body: ${{ inputs.release_note }} | |
| files: d-party_${{ steps.version.outputs.new_version }}.zip | |
| generate_release_notes: true | |
| target_commitish: main | |
| - name: Upload to Chrome Web Store | |
| uses: mnao305/chrome-extension-upload@v6.0.0 | |
| with: | |
| file-path: d-party_${{ steps.version.outputs.new_version }}.zip | |
| extension-id: ${{ secrets.EXTENSION_ID }} | |
| client-id: ${{ secrets.CLIENT_ID }} | |
| client-secret: ${{ secrets.CLIENT_SECRET }} | |
| refresh-token: ${{ secrets.REFRESH_TOKEN }} | |
| # 既定はアップロードのみ。root から publish=true が渡されたときだけ公開申請する。 | |
| publish: ${{ inputs.publish }} |