2
0

release.yml 7.1 KB

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