release.yml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. name: Release
  2. on:
  3. pull_request:
  4. branches:
  5. - release/current
  6. - release/*.*.*
  7. types: [closed]
  8. jobs:
  9. create-github-release:
  10. runs-on: ubuntu-latest
  11. if: github.event.pull_request.merged == true
  12. outputs:
  13. RELEASED_VERSION: ${{ steps.package-json.outputs.packageVersion }}
  14. steps:
  15. - uses: actions/checkout@v4
  16. with:
  17. ref: ${{ github.event.pull_request.base.ref }}
  18. - uses: actions/setup-node@v4
  19. with:
  20. node-version: '20'
  21. cache: 'yarn'
  22. cache-dependency-path: '**/yarn.lock'
  23. - name: Install dependencies
  24. run: |
  25. yarn global add turbo
  26. yarn global add node-gyp
  27. yarn --frozen-lockfile
  28. - name: Bump versions
  29. run: |
  30. turbo run version --filter=@growi/app -- --patch
  31. yarn upgrade --scope=@growi
  32. sh ./apps/app/bin/github-actions/update-readme.sh
  33. - name: Retrieve information from package.json
  34. uses: myrotvorets/info-from-package-json-action@1.2.0
  35. id: package-json
  36. - name: Update Changelog
  37. uses: stefanzweifel/changelog-updater-action@v1
  38. with:
  39. latest-version: v${{ steps.package-json.outputs.packageVersion }}
  40. release-notes: ${{ github.event.pull_request.body }}
  41. - name: Update README.md for docker image
  42. working-directory: ./apps/app
  43. run: |
  44. sh ./bin/github-actions/update-readme.sh
  45. env:
  46. RELEASED_VERSION: ${{ steps.package-json.outputs.packageVersion }}
  47. - name: Commit, Tag and Push
  48. uses: stefanzweifel/git-auto-commit-action@v4
  49. with:
  50. branch: ${{ github.event.pull_request.base.ref }}
  51. commit_message: Release v${{ steps.package-json.outputs.packageVersion }}
  52. tagging_message: v${{ steps.package-json.outputs.packageVersion }}
  53. - uses: softprops/action-gh-release@v1
  54. with:
  55. body: ${{ github.event.pull_request.body }}
  56. tag_name: v${{ steps.package-json.outputs.packageVersion }}
  57. target_commitish: ${{ github.head_ref }}
  58. - name: Delete drafts
  59. uses: hugo19941994/delete-draft-releases@v1.0.1
  60. env:
  61. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  62. determine-tags:
  63. needs: create-github-release
  64. runs-on: ubuntu-latest
  65. outputs:
  66. TAGS: ${{ steps.meta.outputs.tags }}
  67. steps:
  68. - uses: actions/checkout@v4
  69. - name: Retrieve information from package.json
  70. uses: myrotvorets/info-from-package-json-action@1.2.0
  71. id: package-json
  72. - name: Docker meta for docker.io
  73. uses: docker/metadata-action@v4
  74. id: meta
  75. with:
  76. images: docker.io/weseek/growi
  77. sep-tags: ','
  78. tags: |
  79. type=raw,value=latest
  80. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}
  81. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}
  82. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}.{{patch}}
  83. publish-core-styles:
  84. needs: create-github-release
  85. runs-on: ubuntu-latest
  86. steps:
  87. - uses: actions/checkout@v4
  88. with:
  89. ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  90. - uses: actions/setup-node@v4
  91. with:
  92. node-version: '20'
  93. registry-url: 'https://registry.npmjs.org'
  94. - name: npm publish
  95. working-directory: ./packages/core-styles
  96. run: |
  97. npm publish --provenance --access public
  98. env:
  99. NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_PUBLISH_CORE_STYLES }}
  100. build-app-image:
  101. needs: create-github-release
  102. uses: weseek/growi/.github/workflows/reusable-app-build-image.yml@master
  103. with:
  104. source-version: refs/tags/v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  105. image-name: weseek/growi
  106. tag-temporary: latest
  107. secrets:
  108. AWS_ROLE_TO_ASSUME_FOR_OIDC: ${{ secrets.AWS_ROLE_TO_ASSUME_FOR_OIDC }}
  109. publish-app-image:
  110. needs: [determine-tags, build-app-image]
  111. uses: weseek/growi/.github/workflows/reusable-app-create-manifests.yml@master
  112. with:
  113. tags: ${{ needs.determine-tags.outputs.TAGS }}
  114. registry: docker.io
  115. image-name: weseek/growi
  116. tag-temporary: latest
  117. secrets:
  118. DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  119. post-publish:
  120. needs: [create-github-release, publish-app-image]
  121. runs-on: ubuntu-latest
  122. steps:
  123. - uses: actions/checkout@v4
  124. with:
  125. ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  126. - name: Update Docker Hub Description
  127. uses: peter-evans/dockerhub-description@v3
  128. with:
  129. username: wsmoogle
  130. password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  131. repository: weseek/growi
  132. readme-filepath: ./apps/app/docker/README.md
  133. - name: Slack Notification
  134. uses: weseek/ghaction-release-slack-notification@master
  135. with:
  136. channel: '#release'
  137. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  138. created_tag: 'v${{ needs.create-github-release.outputs.RELEASED_VERSION }}'
  139. create-pr-for-next-rc:
  140. needs: [create-github-release, publish-app-image]
  141. runs-on: ubuntu-latest
  142. steps:
  143. - uses: actions/checkout@v4
  144. with:
  145. ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  146. - uses: actions/setup-node@v4
  147. with:
  148. node-version: '20'
  149. cache: 'yarn'
  150. cache-dependency-path: '**/yarn.lock'
  151. - name: Install dependencies
  152. run: |
  153. yarn global add turbo
  154. yarn global add node-gyp
  155. yarn --frozen-lockfile
  156. - name: Bump versions for next RC
  157. run: |
  158. turbo run version --filter=@growi/app -- --prepatch
  159. turbo run version --filter=@growi/slackbot-proxy -- --prepatch
  160. yarn upgrade --scope=@growi
  161. - name: Retrieve information from package.json
  162. uses: myrotvorets/info-from-package-json-action@1.2.0
  163. id: package-json
  164. - name: Commit
  165. uses: github-actions-x/commit@v2.9
  166. with:
  167. github-token: ${{ secrets.GITHUB_TOKEN }}
  168. push-branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  169. commit-message: 'Bump version'
  170. name: GitHub Action
  171. - name: Create PR
  172. uses: repo-sync/pull-request@v2
  173. with:
  174. source_branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  175. destination_branch: ${{ github.head_ref }}
  176. pr_title: Prepare v${{ steps.package-json.outputs.packageVersion }}
  177. pr_label: flag/exclude-from-changelog,type/prepare-next-version
  178. pr_body: "[skip ci] An automated PR generated by create-pr-for-next-rc"
  179. github_token: ${{ secrets.GITHUB_TOKEN }}