release.yml 7.6 KB

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