release.yml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. name: Release
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. branch:
  6. description: 'Branch to publish'
  7. required: true
  8. default: 'main'
  9. type: choice
  10. options:
  11. - main
  12. - minor
  13. bump:
  14. description: 'Bump version'
  15. required: true
  16. default: 'patch'
  17. type: choice
  18. options:
  19. - patch
  20. - minor
  21. - prepatch
  22. - preminor
  23. - custom
  24. custom_version:
  25. description: 'Custom version'
  26. required: false
  27. default: ''
  28. type: string
  29. jobs:
  30. release:
  31. # prevents this action from running on forks
  32. if: github.repository == 'vuejs/core'
  33. runs-on: ubuntu-latest
  34. permissions:
  35. contents: write
  36. id-token: write
  37. # Use Release environment for deployment protection
  38. environment: Release
  39. steps:
  40. - name: Checkout
  41. uses: actions/checkout@v4
  42. with:
  43. ref: ${{ inputs.branch }}
  44. fetch-depth: 0 # need this to get tags for changelog generation
  45. - name: Install pnpm
  46. uses: pnpm/action-setup@v4
  47. - name: Install Node.js
  48. uses: actions/setup-node@v4
  49. with:
  50. node-version-file: '.node-version'
  51. registry-url: 'https://registry.npmjs.org'
  52. cache: 'pnpm'
  53. - name: Install deps
  54. run: pnpm install
  55. - name: Configure git user as vue bot
  56. run: |
  57. git config user.name "vue-bot"
  58. git config user.email "<bot@vuejs.org>"
  59. - name: Import GPG key
  60. uses: crazy-max/ghaction-import-gpg@v6
  61. with:
  62. gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
  63. passphrase: ${{ secrets.GPG_PASSPHRASE }}
  64. git_user_signingkey: true
  65. git_commit_gpgsign: true
  66. - name: Run release script
  67. id: release
  68. run: |
  69. pnpm release ${{ inputs.bump != 'custom' && inputs.bump || inputs.custom_version }} --skipPrompts
  70. RELEASE_TAG=$(git describe --tags --abbrev=0)
  71. echo "tag=$RELEASE_TAG" >> $GITHUB_OUTPUT
  72. env:
  73. NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
  74. - name: Push tags
  75. run: git push -u origin ${{ inputs.branch }} --follow-tags
  76. - name: Create Release for Tag
  77. id: release_tag
  78. uses: yyx990803/release-tag@master
  79. env:
  80. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  81. with:
  82. tag_name: ${{ steps.release.outputs.tag }}
  83. body: |
  84. For stable releases, please refer to [CHANGELOG.md](https://github.com/vuejs/core/blob/main/CHANGELOG.md) for details.
  85. For pre-releases, please refer to [CHANGELOG.md](https://github.com/vuejs/core/blob/minor/CHANGELOG.md) of the `minor` branch.