release.yml 6.1 KB

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