publish.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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@v2
  14. with:
  15. token: ${{ secrets.PAT }}
  16. - name: npm install
  17. run: npm i -g lerna && 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. npm config set registry=https://registry.npmjs.org/
  31. npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
  32. npm whoami
  33. DIST_TAG=latest
  34. if [ $RELEASE_TYPE == 'beta' ]; then
  35. DIST_TAG=beta
  36. fi
  37. echo "$RELEASE_VERSION"
  38. echo "$DIST_TAG"
  39. lerna version $RELEASE_VERSION --exact --force-publish --yes --no-push
  40. lerna publish from-package --dist-tag $DIST_TAG --yes
  41. git push -o ci.skip --follow-tags --no-verify --atomic