name: Publish(both v19 && ~/.ssh/ssh-ed25519 echo $SEMI_TEAM_PRIVATE_KEY_PUB > ~/.ssh/ssh-ed25519.pub echo "Host\n github.com\n AddKeysToAgent yes\n UseKeychain yes\n IdentityFile ~/.ssh/id_ed25519" > ~/.ssh/config - uses: actions/checkout@v4 with: ref: ${{ github.head_ref || github.ref_name }} - name: Print branch run: echo "branch=${{ github.head_ref || github.ref_name }}" - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' cache: 'yarn' registry-url: 'https://registry.npmjs.org' # 安装 - name: npm install run: npm i -g lerna@^4.0.0 && npm run bootstrap # 生成 semi-ui-19 的包 - name: Build React 19 version if: ${{ github.event.inputs.publish_react19 }} run: | node scripts/react19-build.js 19 echo "Build semi-ui-19"; # 再运行一次,保证 semi-ui-19 中的依赖包安装正确 - name: npm install again run: npm run bootstrap - name: get version list run: | PKG_NAME=@douyinfe/semi-ui echo "VERSION_LIST="$(npm view $PKG_NAME versions --json)"" >> $GITHUB_ENV - name: get version run: echo "RELEASE_VERSION="$(node scripts/version.js)"" >> $GITHUB_ENV env: RELEASE_TYPE: ${{ github.event.inputs.release_type }} # publish 的时候不提交 semi-ui-19 相关的修改 - name: publish run: | git config --global user.name 'semi-team' git config --global user.email 'semi-team@bytedance.com' node scripts/sitemap_update.js if [ -n "$(git status --porcelain)" ]; then echo "there are changes"; git add . ':(exclude)packages/semi-ui-19' git commit --no-verify -m "chore: publish ${{ env.RELEASE_VERSION }}" else echo "no changes"; fi git add packages/semi-ui-19 git commit --no-verify -m "chore: semi-ui-19-related" npm config set registry=https://registry.npmjs.org/ npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN_NEW }} npm whoami DIST_TAG=latest if [[ ${{ github.event.inputs.release_type }} == 'beta' ]]; then DIST_TAG=beta elif [[ ${{ github.event.inputs.release_type }} == 'alpha' ]]; then DIST_TAG=alpha fi echo "$RELEASE_VERSION" echo "$DIST_TAG" lerna version $RELEASE_VERSION --exact --force-publish --yes --no-push lerna publish from-package --dist-tag $DIST_TAG --yes git tag -d "v${{env.RELEASE_VERSION}}" git reset HEAD~2 rm -rf packages/semi-ui-19 git add . git commit --no-verify -m "v${{env.RELEASE_VERSION}}" git tag "v${{env.RELEASE_VERSION}}" git tag --list "v${{env.RELEASE_VERSION}}" git rev-parse "v${{env.RELEASE_VERSION}}" git push -o ci.skip --follow-tags --no-verify --atomic git push origin "v${{env.RELEASE_VERSION}}" --no-verify