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
  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: softprops/action-gh-release@v1
  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. TAGS_GHCR: ${{ steps.meta-ghcr.outputs.tags }}
  67. steps:
  68. - uses: actions/checkout@v3
  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. - name: Docker meta for ghcr.io
  84. uses: docker/metadata-action@v4
  85. id: meta-ghcr
  86. with:
  87. images: ghcr.io/weseek/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-image:
  95. needs: create-github-release
  96. uses: weseek/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: weseek/growi
  100. tag-temporary: latest
  101. secrets:
  102. AWS_ROLE_TO_ASSUME_FOR_OIDC: ${{ secrets.AWS_ROLE_TO_ASSUME_FOR_OIDC }}
  103. publish-image:
  104. needs: [determine-tags, build-image]
  105. uses: weseek/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: weseek/growi
  110. tag-temporary: latest
  111. secrets:
  112. DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  113. publish-image-ghcr:
  114. needs: [determine-tags, build-image]
  115. uses: weseek/growi/.github/workflows/reusable-app-create-manifests.yml@master
  116. with:
  117. tags: ${{ needs.determine-tags.outputs.TAGS_GHCR }}
  118. registry: ghcr.io
  119. image-name: weseek/growi
  120. tag-temporary: latest
  121. secrets:
  122. DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_ON_GITHUB_PASSWORD }}
  123. post-publish:
  124. needs: [publish-image, publish-image-ghcr]
  125. runs-on: ubuntu-latest
  126. steps:
  127. - uses: actions/checkout@v3
  128. with:
  129. ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  130. - name: Update Docker Hub Description
  131. uses: peter-evans/dockerhub-description@v3
  132. with:
  133. username: wsmoogle
  134. password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  135. repository: weseek/growi
  136. readme-filepath: ./apps/app/docker/README.md
  137. - name: Slack Notification
  138. uses: weseek/ghaction-release-slack-notification@master
  139. with:
  140. channel: '#release'
  141. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  142. created_tag: 'v${{ needs.create-github-release.outputs.RELEASED_VERSION }}'
  143. - name: Check whether workspace is clean
  144. run: |
  145. STATUS=`git status --porcelain`
  146. if [ -z "$STATUS" ]; then exit 0; else exit 1; fi
  147. create-pr-for-next-rc:
  148. needs: [publish-image, publish-image-ghcr]
  149. runs-on: ubuntu-latest
  150. steps:
  151. - uses: actions/checkout@v3
  152. with:
  153. ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  154. - uses: actions/setup-node@v3
  155. with:
  156. node-version: '18'
  157. cache: 'yarn'
  158. cache-dependency-path: '**/yarn.lock'
  159. - name: Install dependencies
  160. run: |
  161. yarn global add turbo
  162. yarn --frozen-lockfile
  163. - name: Bump versions for next RC
  164. run: |
  165. turbo run version --filter=@growi/app -- --prepatch
  166. turbo run version --filter=@growi/slackbot-proxy -- --prepatch
  167. yarn upgrade --scope=@growi
  168. - name: Retrieve information from package.json
  169. uses: myrotvorets/info-from-package-json-action@1.2.0
  170. id: package-json
  171. - name: Commit
  172. uses: github-actions-x/commit@v2.9
  173. with:
  174. github-token: ${{ secrets.GITHUB_TOKEN }}
  175. push-branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  176. commit-message: 'Bump version'
  177. name: GitHub Action
  178. - name: Create PR
  179. uses: repo-sync/pull-request@v2
  180. with:
  181. source_branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  182. destination_branch: ${{ github.head_ref }}
  183. pr_title: Prepare v${{ steps.package-json.outputs.packageVersion }}
  184. pr_label: flag/exclude-from-changelog,type/prepare-next-version
  185. pr_body: "[skip ci] An automated PR generated by create-pr-for-next-rc"
  186. github_token: ${{ secrets.GITHUB_TOKEN }}