release.yml 7.0 KB

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