publish.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. name: 'publish'
  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. - uses: actions/checkout@v3
  14. with:
  15. token: ${{ secrets.PAT }}
  16. - name: Use Node.js 16
  17. uses: actions/setup-node@v3
  18. with:
  19. node-version: 16
  20. - name: npm install
  21. run: npm i -g lerna@^4.0.0 && npm run bootstrap
  22. - name: get version list
  23. run: |
  24. PKG_NAME=@douyinfe/semi-ui
  25. echo "VERSION_LIST="$(npm view $PKG_NAME versions --json)"" >> $GITHUB_ENV
  26. - name: get version
  27. run: echo "RELEASE_VERSION="$(node scripts/version.js)"" >> $GITHUB_ENV
  28. env:
  29. RELEASE_TYPE: ${{ github.event.inputs.release_type }}
  30. - name: publish
  31. run: |
  32. git config --global user.name 'semi-bot'
  33. git config --global user.email '[email protected]'
  34. node scripts/sitemap_update.js
  35. if [ -n "$(git status --porcelain)" ]; then
  36. echo "there are changes";
  37. git add .
  38. git commit --no-verify -m "chore: publish ${{ env.RELEASE_VERSION }}"
  39. else
  40. echo "no changes";
  41. fi
  42. npm config set registry=https://registry.npmjs.org/
  43. npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
  44. npm whoami
  45. DIST_TAG=latest
  46. if [[ ${{ github.event.inputs.release_type }} == 'beta' ]]; then
  47. DIST_TAG=beta
  48. fi
  49. echo "$RELEASE_VERSION"
  50. echo "$DIST_TAG"
  51. lerna version $RELEASE_VERSION --exact --force-publish --yes --no-push
  52. lerna publish from-package --dist-tag $DIST_TAG --yes
  53. git push -o ci.skip --follow-tags --no-verify --atomic
  54. # env:
  55. # NODE_OPTIONS: '--no-experimental-fetch --openssl-legacy-provider'