2
0

publish-app.yml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. name: Publish-Apps
  2. on: workflow_dispatch
  3. concurrency:
  4. group: "main-branch-workflow" # 唯一标识符,确保只运行一个实例
  5. cancel-in-progress: false # 不取消正在运行的实例,后续触发需要等待当前实例完成
  6. jobs:
  7. build:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - uses: actions/checkout@v3
  11. with:
  12. fetch-depth: 2
  13. - name: Set up npm token
  14. env:
  15. NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
  16. run: echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
  17. - name: Debug Auth
  18. env:
  19. NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
  20. run: |
  21. npm whoami
  22. - name: Config Git User
  23. run: |
  24. git config --local user.name "dragooncjw"
  25. git config --local user.email "289056872@qq.com"
  26. - name: Get latest npm version
  27. id: get_version
  28. run: |
  29. LATEST_VERSION=$(npm view @flowgram.ai/demo-fixed-layout version --tag=latest latest)
  30. echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV
  31. # https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
  32. - name: Echo version
  33. run: |
  34. echo "The package version is : $LATEST_VERSION"
  35. echo "The package output version is ${{ steps.get_version.outputs.version }}"
  36. - uses: actions/setup-node@v3
  37. with:
  38. node-version: 18
  39. registry-url: "https://registry.npmjs.org/"
  40. - name: Rush Install
  41. run: node common/scripts/install-run-rush.js install
  42. - name: Rush build
  43. run: node common/scripts/install-run-rush.js build
  44. # version bump 之前保证是远端最新的,这样无需 commit package.json version
  45. - name: Sync versions
  46. run: |
  47. echo "[
  48. {
  49. \"policyName\": \"appPolicy\",
  50. \"definitionName\": \"lockStepVersion\",
  51. \"version\": \"$LATEST_VERSION\",
  52. \"nextBump\": \"patch\"
  53. }
  54. ]" > common/config/rush/version-policies.json
  55. - name: Version Bump
  56. run: node common/scripts/install-run-rush.js version --bump --version-policy appPolicy
  57. - name: Publish
  58. env:
  59. NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
  60. run: node common/scripts/install-run-rush.js publish --include-all -p --tag latest