release.yml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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 }}-TEST
  50. tagging_message: v${{ steps.package-json.outputs.packageVersion }}-TEST
  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. id: meta
  112. with:
  113. images: docker.io/weseek/growi-codebuild-test
  114. sep-tags: ','
  115. tags: |
  116. type=raw,value=latest
  117. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}
  118. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}
  119. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}.{{patch}}
  120. - name: Docker meta for ghcr.io
  121. uses: docker/metadata-action@v4
  122. id: meta-ghcr
  123. with:
  124. images: ghcr.io/weseek/growi-codebuild-test
  125. sep-tags: ','
  126. tags: |
  127. type=raw,value=latest
  128. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}
  129. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}
  130. type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}.{{patch}}
  131. build-image:
  132. needs: create-github-release
  133. uses: weseek/growi/.github/workflows/reusable-app-build-image.yml@support/build-with-codebuild
  134. with:
  135. source-version: refs/tags/v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  136. image-name: weseek/growi-codebuild-test
  137. tag-temporary: latest
  138. secrets:
  139. AWS_ROLE_TO_ASSUME_FOR_OIDC: ${{ secrets.AWS_ROLE_TO_ASSUME_FOR_OIDC }}
  140. publish-image:
  141. needs: [determine-tags, build-image]
  142. uses: weseek/growi/.github/workflows/reusable-app-create-manifests.yml@support/build-with-codebuild
  143. with:
  144. tags: ${{ needs.determine-tags.outputs.TAGS }}
  145. registry: docker.io
  146. image-name: weseek/growi-codebuild-test
  147. tag-temporary: latest
  148. secrets:
  149. DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  150. publish-image-ghcr:
  151. needs: [determine-tags, build-image]
  152. uses: weseek/growi/.github/workflows/reusable-app-create-manifests.yml@support/build-with-codebuild
  153. with:
  154. tags: ${{ needs.determine-tags.outputs.TAGS_GHCR }}
  155. registry: ghcr.io
  156. image-name: weseek/growi-codebuild-test
  157. tag-temporary: latest
  158. secrets:
  159. DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_ON_GITHUB_PASSWORD }}
  160. post-publish:
  161. needs: [create-github-release, publish-image, publish-image-ghcr]
  162. runs-on: ubuntu-latest
  163. steps:
  164. - uses: actions/checkout@v3
  165. with:
  166. ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
  167. # - name: Update Docker Hub Description
  168. # uses: peter-evans/dockerhub-description@v3
  169. # with:
  170. # username: wsmoogle
  171. # password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  172. # repository: weseek/growi
  173. # readme-filepath: ./packages/app/docker/README.md
  174. - name: Slack Notification
  175. uses: weseek/ghaction-release-slack-notification@master
  176. with:
  177. channel: '#release'
  178. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  179. created_tag: 'v${{ needs.create-github-release.outputs.RELEASED_VERSION }}'
  180. - name: Check whether workspace is clean
  181. run: |
  182. STATUS=`git status --porcelain`
  183. if [ -z "$STATUS" ]; then exit 0; else exit 1; fi