π Release #139
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 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: Version | |
| required: true | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| prepare: | |
| if: ${{ github.event.inputs.version != '' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: π Set all monorepo's package version | |
| run: | | |
| node -e "const fs = require('fs'); const package = JSON.parse(fs.readFileSync('./package.json')); package.version = '${{ github.event.inputs.version }}'; fs.writeFileSync('./package.json', JSON.stringify(package, null, 2) + '\n');" | |
| for package in $(ls packages); do | |
| node -e "const fs = require('fs'); const package = JSON.parse(fs.readFileSync('./packages/$package/package.json')); package.version = '${{ github.event.inputs.version }}'; fs.writeFileSync('./packages/$package/package.json', JSON.stringify(package, null, 2) + '\n');" | |
| done | |
| - name: π Commit and push changes | |
| run: | | |
| git config --global user.email "actions@github.com" | |
| git config --global user.name "GitHub Actions" | |
| git add -A | |
| git commit -m "chore(release): v${{ github.event.inputs.version }}" || exit 0 | |
| git push | |
| git tag -a v${{ github.event.inputs.version }} -m "v${{ github.event.inputs.version }}" | |
| git push origin v${{ github.event.inputs.version }} | |
| release-npm: | |
| needs: [prepare] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: v${{ github.event.inputs.version }} | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| run_install: false | |
| - name: Install Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| registry-url: https://registry.npmjs.org | |
| - name: π Install & Build & Publish | |
| run: | | |
| pnpm i | |
| pnpm build | |
| pnpm publish --access public -r --no-git-checks | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| dispatch-docs: | |
| needs: [release-npm] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Invoke deployment hook | |
| uses: peter-evans/repository-dispatch@v2 | |
| with: | |
| token: ${{ secrets.GH_TOKEN }} | |
| repository: dream-num/univer.ai | |
| event-type: deploy |