release.yml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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@v3
  16. with:
  17. ref: ${{ github.event.pull_request.base.ref }}
  18. - uses: actions/setup-node@v3
  19. with:
  20. node-version: '18'
  21. cache: 'yarn'
  22. cache-dependency-path: '**/yarn.lock'
  23. - name: Install dependencies
  24. run: |
  25. yarn global add turbo@1.10.9
  26. yarn --frozen-lockfile
  27. - name: Bump versions
  28. run: |
  29. turbo run version --filter=@growi/app -- --patch
  30. yarn upgrade --scope=@growi
  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@1.2.0
  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@v4
  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: ncipollo/release-action@v1
  53. with:
  54. body: ${{ github.event.pull_request.body }}
  55. tag: v${{ steps.package-json.outputs.packageVersion }}
  56. token: ${{ secrets.GITHUB_TOKEN }}
  57. - name: Delete drafts
  58. uses: hugo19941994/delete-draft-releases@v1.0.1
  59. env:
  60. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  61. create-pr-for-next-rc:
  62. needs: create-github-release
  63. runs-on: ubuntu-latest
  64. steps:
  65. - uses: actions/checkout@v3
  66. with:
  67. ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  68. - uses: actions/setup-node@v3
  69. with:
  70. node-version: '18'
  71. cache: 'yarn'
  72. cache-dependency-path: '**/yarn.lock'
  73. - name: Install dependencies
  74. run: |
  75. yarn global add turbo@1.10.9
  76. yarn --frozen-lockfile
  77. - name: Bump versions for next RC
  78. run: |
  79. turbo run version --filter=@growi/app -- --prepatch
  80. turbo run version --filter=@growi/slackbot-proxy -- --prepatch
  81. yarn upgrade --scope=@growi
  82. - name: Retrieve information from package.json
  83. uses: myrotvorets/info-from-package-json-action@1.2.0
  84. id: package-json
  85. - name: Commit
  86. uses: github-actions-x/commit@v2.9
  87. with:
  88. github-token: ${{ secrets.GITHUB_TOKEN }}
  89. push-branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  90. commit-message: 'Bump version'
  91. name: GitHub Action
  92. - name: Create PR
  93. uses: repo-sync/pull-request@v2
  94. with:
  95. source_branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  96. destination_branch: master
  97. pr_title: Prepare v${{ steps.package-json.outputs.packageVersion }}
  98. pr_label: flag/exclude-from-changelog,type/prepare-next-version
  99. pr_body: "[skip ci] An automated PR generated by create-pr-for-next-rc"
  100. github_token: ${{ secrets.GITHUB_TOKEN }}
  101. determine-tags:
  102. needs: create-github-release
  103. runs-on: ubuntu-latest
  104. outputs:
  105. TAGS: ${{ steps.meta.outputs.tags }}
  106. TAGS_GHCR: ${{ steps.meta-ghcr.outputs.tags }}
  107. steps:
  108. - uses: actions/checkout@v3
  109. - name: Retrieve information from package.json
  110. uses: myrotvorets/info-from-package-json-action@1.2.0
  111. id: package-json
  112. - name: Docker meta for docker.io
  113. uses: docker/metadata-action@v4
  114. id: meta
  115. with:
  116. images: docker.io/weseek/growi
  117. sep-tags: ','
  118. tags: |
  119. type=raw,value=latest
  120. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}
  121. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}
  122. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}.{{patch}}
  123. - name: Docker meta for ghcr.io
  124. uses: docker/metadata-action@v4
  125. id: meta-ghcr
  126. with:
  127. images: ghcr.io/weseek/growi
  128. sep-tags: ','
  129. tags: |
  130. type=raw,value=latest
  131. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}
  132. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}
  133. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}.{{patch}}
  134. build-image:
  135. needs: create-github-release
  136. uses: weseek/growi/.github/workflows/reusable-app-build-image.yml@master
  137. with:
  138. source-version: refs/tags/v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  139. image-name: weseek/growi
  140. tag-temporary: latest
  141. secrets:
  142. AWS_ROLE_TO_ASSUME_FOR_OIDC: ${{ secrets.AWS_ROLE_TO_ASSUME_FOR_OIDC }}
  143. publish-image:
  144. needs: [determine-tags, build-image]
  145. uses: weseek/growi/.github/workflows/reusable-app-create-manifests.yml@master
  146. with:
  147. tags: ${{ needs.determine-tags.outputs.TAGS }}
  148. registry: docker.io
  149. image-name: weseek/growi
  150. tag-temporary: latest
  151. secrets:
  152. DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  153. publish-image-ghcr:
  154. needs: [determine-tags, build-image]
  155. uses: weseek/growi/.github/workflows/reusable-app-create-manifests.yml@master
  156. with:
  157. tags: ${{ needs.determine-tags.outputs.TAGS_GHCR }}
  158. registry: ghcr.io
  159. image-name: weseek/growi
  160. tag-temporary: latest
  161. secrets:
  162. DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_ON_GITHUB_PASSWORD }}
  163. post-publish:
  164. needs: [create-github-release, publish-image, publish-image-ghcr]
  165. runs-on: ubuntu-latest
  166. steps:
  167. - uses: actions/checkout@v3
  168. with:
  169. ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  170. - name: Update Docker Hub Description
  171. uses: peter-evans/dockerhub-description@v3
  172. with:
  173. username: wsmoogle
  174. password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  175. repository: weseek/growi
  176. readme-filepath: ./apps/app/docker/README.md
  177. - name: Slack Notification
  178. uses: weseek/ghaction-release-slack-notification@master
  179. with:
  180. channel: '#release'
  181. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  182. created_tag: 'v${{ needs.create-github-release.outputs.RELEASED_VERSION }}'
  183. - name: Check whether workspace is clean
  184. run: |
  185. STATUS=`git status --porcelain`
  186. if [ -z "$STATUS" ]; then exit 0; else exit 1; fi