publish.yml 2.1 KB

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