release.yml 7.0 KB

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