publish.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. name: 'Publish(v18及以下)'
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. release_type:
  6. description: 'release type: minor | patch | beta'
  7. required: true
  8. jobs:
  9. publish-new-version:
  10. name: 'publish a new version'
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: gen token
  14. run: |
  15. git config --global user.name 'semi-team'
  16. git config --global user.email '[email protected]'
  17. mkdir ~/.ssh
  18. echo $SEMI_TEAM_PRIVATE_KEY > ~/.ssh/ssh-ed25519
  19. echo $SEMI_TEAM_PRIVATE_KEY_PUB > ~/.ssh/ssh-ed25519.pub
  20. echo "Host\n github.com\n AddKeysToAgent yes\n UseKeychain yes\n IdentityFile ~/.ssh/id_ed25519" > ~/.ssh/config
  21. - uses: actions/checkout@v4
  22. - name: Use Node.js 20
  23. uses: actions/setup-node@v4
  24. with:
  25. node-version: 20
  26. - name: npm install
  27. run: npm i -g lerna@^4.0.0 && npm run bootstrap
  28. - name: get version list
  29. run: |
  30. PKG_NAME=@douyinfe/semi-ui
  31. echo "VERSION_LIST="$(npm view $PKG_NAME versions --json)"" >> $GITHUB_ENV
  32. - name: get version
  33. run: echo "RELEASE_VERSION="$(node scripts/version.js)"" >> $GITHUB_ENV
  34. env:
  35. RELEASE_TYPE: ${{ github.event.inputs.release_type }}
  36. - name: publish
  37. run: |
  38. git config --global user.name 'semi-team'
  39. git config --global user.email '[email protected]'
  40. node scripts/sitemap_update.js
  41. if [ -n "$(git status --porcelain)" ]; then
  42. echo "there are changes";
  43. git add .
  44. git commit --no-verify -m "chore: publish ${{ env.RELEASE_VERSION }}"
  45. else
  46. echo "no changes";
  47. fi
  48. npm config set registry=https://registry.npmjs.org/
  49. npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
  50. npm whoami
  51. DIST_TAG=latest
  52. if [[ ${{ github.event.inputs.release_type }} == 'beta' ]]; then
  53. DIST_TAG=beta
  54. fi
  55. echo "$RELEASE_VERSION"
  56. echo "$DIST_TAG"
  57. lerna version $RELEASE_VERSION --exact --force-publish --yes --no-push
  58. lerna publish from-package --dist-tag $DIST_TAG --yes
  59. git push -o ci.skip --follow-tags --no-verify --atomic
  60. # env:
  61. # NODE_OPTIONS: '--no-experimental-fetch --openssl-legacy-provider'