👷 build(model-bank): add release workflow (#13384)

* 👷 build(model-bank): add release workflow

* 🐛 fix(model-bank): bundle business const for publish

* Remove ModelBank CI package rewrite before publish
This commit is contained in:
Innei
2026-04-03 19:35:26 +08:00
committed by GitHub
parent 1d7a0d6bd8
commit ec3dd471b1
4 changed files with 128 additions and 0 deletions
+93
View File
@@ -0,0 +1,93 @@
name: Release ModelBank
permissions:
contents: write
id-token: write
on:
push:
branches:
- canary
paths:
- packages/model-bank/**
workflow_dispatch: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build ModelBank
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24.11.1
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.20.0
- name: Install dependencies
run: pnpm install
- name: Build package
run: pnpm --filter model-bank build
publish:
name: Publish ModelBank
if: ${{ github.event_name == 'workflow_dispatch' }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24.11.1
registry-url: https://registry.npmjs.org
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.20.0
- name: Install dependencies
run: pnpm install
- name: Bump patch version
id: version
run: |
npm version patch --no-git-tag-version --prefix packages/model-bank
echo "version=$(node -p 'require(\"./packages/model-bank/package.json\").version')" >> "$GITHUB_OUTPUT"
- name: Build package
run: pnpm --filter model-bank build
- name: Publish to npm
run: npm publish --provenance
working-directory: packages/model-bank
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Commit version bump
env:
MODEL_BANK_VERSION: ${{ steps.version.outputs.version }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add packages/model-bank/package.json
git commit -m "🔖 chore(model-bank): release v${MODEL_BANK_VERSION}"
git push