| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- name: Publish
- on:
- workflow_dispatch
- concurrency:
- group: "main-branch-workflow" # 唯一标识符,确保只运行一个实例
- cancel-in-progress: false # 不取消正在运行的实例,后续触发需要等待当前实例完成
- jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- with:
- fetch-depth: 2
- - name: Set up npm token
- env:
- NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- run: echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
- - name: Debug Auth
- env:
- NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- run: |
- npm whoami
- - name: Config Git User
- run: |
- git config --local user.name "chenjiawei.inizio"
- git config --local user.email "chenjiawei.inizio@bytedance.com"
- - name: Get latest npm version
- id: get_version
- run: |
- LATEST_VERSION=$(npm view @flowgram.ai/core version --tag=latest latest)
- echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV
- echo "::set-output name=version::$LATEST_VERSION"
- - name: Echo version
- run: |
- echo "The package version is : $LATEST_VERSION"
- echo "The package output version is ${{ steps.get_version.outputs.version }}"
- - uses: actions/setup-node@v3
- with:
- node-version: 18
- registry-url: 'https://registry.npmjs.org/'
- - name: Rush Install
- run: node common/scripts/install-run-rush.js install
- - name: Rush build
- run: node common/scripts/install-run-rush.js build
- # version bump 之前保证是远端最新的,这样无需 commit package.json version
- - name: Sync versions
- run: |
- echo "[
- {
- \"policyName\": \"publishPolicy\",
- \"definitionName\": \"lockStepVersion\",
- \"version\": \"$LATEST_VERSION\",
- \"nextBump\": \"patch\"
- }
- ]" > common/config/rush/version-policies.json
- - name: Version Bump
- run: node common/scripts/install-run-rush.js version --bump
- - name: Publish
- env:
- NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- run: node common/scripts/install-run-rush.js publish --include-all -p --tag latest
|