release.yml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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: ${{ steps.meta.outputs.tags }}
  66. steps:
  67. - uses: actions/checkout@v4
  68. - name: Retrieve information from package.json
  69. uses: myrotvorets/info-from-package-json-action@v2.0.2
  70. id: package-json
  71. - name: Docker meta for docker.io
  72. uses: docker/metadata-action@v5
  73. id: meta
  74. with:
  75. images: |
  76. docker.io/weseek/growi
  77. docker.io/growilabs/growi
  78. sep-tags: ','
  79. tags: |
  80. type=raw,value=latest
  81. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}
  82. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}
  83. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}.{{patch}}
  84. build-app-image:
  85. needs: create-github-release
  86. strategy:
  87. matrix:
  88. image-name: [weseek/growi, growilabs/growi]
  89. uses: growilabs/growi/.github/workflows/reusable-app-build-image.yml@master
  90. with:
  91. source-version: refs/tags/v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  92. image-name: ${{ matrix.image-name }}
  93. tag-temporary: latest
  94. secrets:
  95. AWS_ROLE_TO_ASSUME_FOR_OIDC: ${{ secrets.AWS_ROLE_TO_ASSUME_FOR_OIDC }}
  96. publish-app-image:
  97. needs: [determine-tags, build-app-image]
  98. strategy:
  99. matrix:
  100. include:
  101. - image-name: weseek/growi
  102. username: wsmoogle
  103. - image-name: growilabs/growi
  104. username: growimoogle
  105. uses: growilabs/growi/.github/workflows/reusable-app-create-manifests.yml@master
  106. with:
  107. tags: ${{ needs.determine-tags.outputs.TAGS }}
  108. registry: docker.io
  109. image-name: ${{ matrix.image-name }}
  110. username: ${{ matrix.username }}
  111. tag-temporary: latest
  112. secrets:
  113. DOCKER_REGISTRY_PASSWORD: ${{ matrix.image-name == 'weseek/growi' && secrets.DOCKER_REGISTRY_PASSWORD || secrets.DOCKER_REGISTRY_PASSWORD_GROWIMOOGLE }}
  114. post-publish:
  115. needs: [create-github-release, publish-app-image]
  116. runs-on: ubuntu-latest
  117. strategy:
  118. matrix:
  119. include:
  120. - repository: weseek/growi
  121. username: wsmoogle
  122. - repository: growilabs/growi
  123. username: growimoogle
  124. steps:
  125. - uses: actions/checkout@v4
  126. with:
  127. ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  128. - name: Update Docker Hub Description
  129. uses: peter-evans/dockerhub-description@v4
  130. with:
  131. username: ${{ matrix.username }}
  132. password: ${{ matrix.repository == 'weseek/growi' && secrets.DOCKER_REGISTRY_PASSWORD || secrets.DOCKER_REGISTRY_PASSWORD_GROWIMOOGLE }}
  133. repository: ${{ matrix.repository }}
  134. readme-filepath: ./apps/app/docker/README.md
  135. - name: Slack Notification
  136. uses: weseek/ghaction-release-slack-notification@master
  137. with:
  138. channel: '#release'
  139. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  140. created_tag: 'v${{ needs.create-github-release.outputs.RELEASED_VERSION }}'
  141. create-pr-for-next-rc:
  142. needs: [create-github-release, publish-app-image]
  143. runs-on: ubuntu-latest
  144. steps:
  145. - uses: actions/checkout@v4
  146. with:
  147. ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  148. - uses: pnpm/action-setup@v4
  149. - uses: actions/setup-node@v4
  150. with:
  151. node-version: '22'
  152. cache: 'pnpm'
  153. - name: Install dependencies
  154. run: |
  155. pnpm add turbo --global
  156. pnpm install --frozen-lockfile
  157. - name: Bump versions for next RC
  158. run: |
  159. turbo run version:prepatch --filter=@growi/app
  160. turbo run version:prepatch --filter=@growi/slackbot-proxy
  161. - name: Retrieve information from package.json
  162. uses: myrotvorets/info-from-package-json-action@v2.0.2
  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 }}