release.yml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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@v4
  16. with:
  17. ref: ${{ github.event.pull_request.base.ref }}
  18. - uses: actions/setup-node@v4
  19. with:
  20. node-version: '20'
  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. steps:
  68. - uses: actions/checkout@v4
  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. build-app-image:
  84. needs: create-github-release
  85. uses: weseek/growi/.github/workflows/reusable-app-build-image.yml@master
  86. with:
  87. source-version: refs/tags/v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  88. image-name: weseek/growi
  89. tag-temporary: latest
  90. secrets:
  91. AWS_ROLE_TO_ASSUME_FOR_OIDC: ${{ secrets.AWS_ROLE_TO_ASSUME_FOR_OIDC }}
  92. publish-app-image:
  93. needs: [determine-tags, build-app-image]
  94. uses: weseek/growi/.github/workflows/reusable-app-create-manifests.yml@master
  95. with:
  96. tags: ${{ needs.determine-tags.outputs.TAGS }}
  97. registry: docker.io
  98. image-name: weseek/growi
  99. tag-temporary: latest
  100. secrets:
  101. DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  102. post-publish:
  103. needs: [create-github-release, publish-app-image]
  104. runs-on: ubuntu-latest
  105. steps:
  106. - uses: actions/checkout@v4
  107. with:
  108. ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  109. - name: Update Docker Hub Description
  110. uses: peter-evans/dockerhub-description@v3
  111. with:
  112. username: wsmoogle
  113. password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  114. repository: weseek/growi
  115. readme-filepath: ./apps/app/docker/README.md
  116. - name: Slack Notification
  117. uses: weseek/ghaction-release-slack-notification@master
  118. with:
  119. channel: '#release'
  120. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  121. created_tag: 'v${{ needs.create-github-release.outputs.RELEASED_VERSION }}'
  122. create-pr-for-next-rc:
  123. needs: [create-github-release, publish-app-image]
  124. runs-on: ubuntu-latest
  125. steps:
  126. - uses: actions/checkout@v4
  127. with:
  128. ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  129. - uses: actions/setup-node@v4
  130. with:
  131. node-version: '20'
  132. cache: 'yarn'
  133. cache-dependency-path: '**/yarn.lock'
  134. - name: Install dependencies
  135. run: |
  136. yarn global add turbo
  137. yarn global add node-gyp
  138. yarn --frozen-lockfile
  139. - name: Bump versions for next RC
  140. run: |
  141. turbo run version --filter=@growi/app -- --prepatch
  142. turbo run version --filter=@growi/slackbot-proxy -- --prepatch
  143. yarn upgrade --scope=@growi
  144. - name: Retrieve information from package.json
  145. uses: myrotvorets/info-from-package-json-action@1.2.0
  146. id: package-json
  147. - name: Commit
  148. uses: github-actions-x/commit@v2.9
  149. with:
  150. github-token: ${{ secrets.GITHUB_TOKEN }}
  151. push-branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  152. commit-message: 'Bump version'
  153. name: GitHub Action
  154. - name: Create PR
  155. uses: repo-sync/pull-request@v2
  156. with:
  157. source_branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  158. destination_branch: ${{ github.head_ref }}
  159. pr_title: Prepare v${{ steps.package-json.outputs.packageVersion }}
  160. pr_label: flag/exclude-from-changelog,type/prepare-next-version
  161. pr_body: "[skip ci] An automated PR generated by create-pr-for-next-rc"
  162. github_token: ${{ secrets.GITHUB_TOKEN }}