release.yml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. name: Release
  2. on:
  3. pull_request:
  4. branches:
  5. # - release/current
  6. # - release/*.*.*
  7. - release/test
  8. types: [closed]
  9. jobs:
  10. create-github-release:
  11. runs-on: ubuntu-latest
  12. if: github.event.pull_request.merged == true
  13. outputs:
  14. RELEASED_VERSION: ${{ steps.package-json.outputs.packageVersion }}-TEST
  15. steps:
  16. - uses: actions/checkout@v3
  17. with:
  18. ref: ${{ github.event.pull_request.base.ref }}
  19. - uses: actions/setup-node@v3
  20. with:
  21. node-version: '16'
  22. cache: 'yarn'
  23. cache-dependency-path: '**/yarn.lock'
  24. - name: Install dependencies
  25. run: |
  26. npx lerna bootstrap
  27. - name: Bump versions
  28. run: |
  29. yarn bump-versions:patch
  30. sh ./packages/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: ./packages/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 }}-TEST
  55. token: ${{ secrets.GITHUB_TOKEN }}
  56. # - name: Delete drafts
  57. # uses: hugo19941994/delete-draft-releases@v1.0.0
  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: '16'
  70. # cache: 'yarn'
  71. # cache-dependency-path: '**/yarn.lock'
  72. # - name: Install dependencies
  73. # run: |
  74. # npx lerna bootstrap
  75. # - name: Bump versions for next RC
  76. # run: |
  77. # yarn bump-versions:rc
  78. # yarn bump-versions:slackbot-proxy
  79. # - name: Retrieve information from package.json
  80. # uses: myrotvorets/info-from-package-json-action@1.2.0
  81. # id: package-json
  82. # - name: Commit
  83. # uses: github-actions-x/commit@v2.9
  84. # with:
  85. # github-token: ${{ secrets.GITHUB_TOKEN }}
  86. # push-branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  87. # commit-message: 'Bump version'
  88. # name: GitHub Action
  89. # - name: Create PR
  90. # uses: repo-sync/pull-request@v2
  91. # with:
  92. # source_branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  93. # destination_branch: master
  94. # pr_title: Prepare v${{ steps.package-json.outputs.packageVersion }}
  95. # pr_label: exclude from changelog,prepare next version
  96. # pr_body: "An automated PR generated by create-pr-for-next-rc"
  97. # github_token: ${{ secrets.GITHUB_TOKEN }}
  98. determine-tags:
  99. needs: create-github-release
  100. runs-on: ubuntu-latest
  101. outputs:
  102. TAGS: ${{ steps.meta.outputs.tags }}
  103. TAGS_GHCR: ${{ steps.meta-ghcr.outputs.tags }}
  104. steps:
  105. - uses: actions/checkout@v3
  106. - name: Retrieve information from package.json
  107. uses: myrotvorets/info-from-package-json-action@1.2.0
  108. id: package-json
  109. - name: Docker meta for docker.io
  110. uses: docker/metadata-action@v4
  111. with:
  112. images: docker.io/weseek/growi-codebuild-test
  113. sep-tags: ','
  114. tags: |
  115. type=raw,value=latest
  116. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}
  117. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}
  118. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}.{{patch}}
  119. - name: Docker meta for ghcr.io
  120. uses: docker/metadata-action@v4
  121. with:
  122. images: ghcr.io/weseek/growi-codebuild-test
  123. sep-tags: ','
  124. tags: |
  125. type=raw,value=latest
  126. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}
  127. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}
  128. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}.{{patch}}
  129. build-image:
  130. needs: create-github-release
  131. uses: weseek/growi/.github/workflows/reusable-app-build-image.yml@support/build-with-codebuild
  132. with:
  133. source-version: refs/tags/v{{ needs.create-github-release.outputs.RELEASED_VERSION }}
  134. image-name: weseek/growi-codebuild-test
  135. tag-temporary: latest
  136. secrets:
  137. AWS_ROLE_TO_ASSUME_FOR_OIDC: ${{ secrets.AWS_ROLE_TO_ASSUME_FOR_OIDC }}
  138. publish-image:
  139. needs: [determine-tags, build-image]
  140. uses: weseek/growi/.github/workflows/reusable-app-create-manifests.yml@support/build-with-codebuild
  141. with:
  142. tags: ${{ needs.determine-tags.outputs.TAGS }}
  143. registry: docker.io
  144. image-name: weseek/growi-codebuild-test
  145. tag-temporary: latest
  146. secrets:
  147. DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  148. publish-image-ghcr:
  149. needs: [determine-tags, build-image]
  150. uses: weseek/growi/.github/workflows/reusable-app-create-manifests.yml@support/build-with-codebuild
  151. with:
  152. tags: ${{ needs.determine-tags.outputs.TAGS_GHCR }}
  153. registry: ghcr.io
  154. image-name: weseek/growi-codebuild-test
  155. tag-temporary: latest
  156. secrets:
  157. DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_ON_GITHUB_PASSWORD }}
  158. post-publish:
  159. needs: [create-github-release, publish-image, publish-image-ghcr]
  160. runs-on: ubuntu-latest
  161. steps:
  162. - uses: actions/checkout@v3
  163. with:
  164. ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  165. # - name: Update Docker Hub Description
  166. # uses: peter-evans/dockerhub-description@v3
  167. # with:
  168. # username: wsmoogle
  169. # password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  170. # repository: weseek/growi
  171. # readme-filepath: ./packages/app/docker/README.md
  172. - name: Slack Notification
  173. uses: weseek/ghaction-release-slack-notification@master
  174. with:
  175. channel: '#release'
  176. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  177. created_tag: 'v${{ needs.create-github-release.outputs.RELEASED_VERSION }}'
  178. - name: Check whether workspace is clean
  179. run: |
  180. STATUS=`git status --porcelain`
  181. if [ -z "$STATUS" ]; then exit 0; else exit 1; fi