Publish(both v19 && <v19) #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: Publish(both v19 && <v19) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release_type: | |
| description: 'release type: minor | patch | beta' | |
| required: true | |
| default: 'patch' | |
| publish_react19: | |
| description: 'publish React 19 version' | |
| type: boolean | |
| required: false | |
| default: true | |
| jobs: | |
| # ๆๆถไธๅ ๆต่ฏ | |
| # test-react-18: | |
| # name: Test with React 18 | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Setup Node.js | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: '20' | |
| # cache: 'yarn' | |
| # - name: Install dependencies | |
| # run: yarn install --frozen-lockfile | |
| # - name: Run tests with React 18 | |
| # run: | | |
| # yarn test | |
| # yarn build | |
| # test-react-19: | |
| # name: Test with React 19 | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Setup Node.js | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: '20' | |
| # cache: 'yarn' | |
| # - name: Install dependencies with React 19 | |
| # run: | | |
| # yarn install --frozen-lockfile | |
| # # ๅ็บงๅฐ React 19 ้ขๅๅธ็ๆฌ | |
| # yarn add react@beta react-dom@beta --dev | |
| # - name: Build React 19 compatible version | |
| # run: | | |
| # node scripts/react19-build.js 19 | |
| # - name: Test React 19 version | |
| # run: | | |
| # # ๅจ่ฟ้่ฟ่ก้ๅ React 19 ็ๆต่ฏ | |
| # echo "Running React 19 specific tests..." | |
| build-and-publish: | |
| name: Build and Publish | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: gen token | |
| run: | | |
| git config --global user.name 'semi-team' | |
| git config --global user.email 'semi-team@bytedance.com' | |
| mkdir ~/.ssh | |
| echo $SEMI_TEAM_PRIVATE_KEY > ~/.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 }} | |
| 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 |