release-slackbot-proxy.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. name: Release Docker Image for @growi/slackbot-proxy
  2. on:
  3. pull_request:
  4. branches:
  5. - release/slackbot-proxy/**
  6. types: [closed]
  7. jobs:
  8. build-and-push-image:
  9. runs-on: ubuntu-latest
  10. steps:
  11. - uses: actions/checkout@v4
  12. with:
  13. ref: ${{ github.event.pull_request.base.ref }}
  14. - name: Retrieve information from package.json
  15. uses: myrotvorets/info-from-package-json-action@v2.0.2
  16. id: package-json
  17. with:
  18. workingDir: apps/slackbot-proxy
  19. - name: Docker meta
  20. id: meta
  21. uses: docker/metadata-action@v5
  22. with:
  23. images: weseek/growi-slackbot-proxy,asia.gcr.io/${{ secrets.GCP_PRJ_ID_SLACKBOT_PROXY }}/growi-slackbot-proxy
  24. tags: |
  25. type=raw,value=latest
  26. type=raw,value=${{ steps.package-json.outputs.packageVersion }}
  27. - name: Login to docker.io registry
  28. run: |
  29. echo ${{ secrets. DOCKER_REGISTRY_PASSWORD }} | docker login --username wsmoogle --password-stdin
  30. - name: Authenticate to Google Cloud for GROWI.cloud
  31. uses: google-github-actions/auth@v2
  32. with:
  33. credentials_json: '${{ secrets.GCP_SA_KEY_SLACKBOT_PROXY }}'
  34. - name: Setup gcloud
  35. uses: google-github-actions/setup-gcloud@v2
  36. - name: Configure docker for gcloud
  37. run: |
  38. gcloud auth configure-docker --quiet
  39. - name: Set up Docker Buildx
  40. uses: docker/setup-buildx-action@v3
  41. - name: Build and push
  42. uses: docker/build-push-action@v4
  43. with:
  44. context: .
  45. file: ./apps/slackbot-proxy/docker/Dockerfile
  46. platforms: linux/amd64
  47. push: true
  48. builder: ${{ steps.buildx.outputs.name }}
  49. cache-from: type=gha
  50. cache-to: type=gha,mode=max
  51. tags: ${{ steps.meta.outputs.tags }}
  52. - name: Move cache
  53. run: |
  54. rm -rf /tmp/.buildx-cache
  55. mv /tmp/.buildx-cache-new /tmp/.buildx-cache
  56. - name: Add tag
  57. uses: anothrNick/github-tag-action@v1
  58. env:
  59. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  60. CUSTOM_TAG: v${{ steps.package-json.outputs.packageVersion }}
  61. VERBOSE : true
  62. - name: Update Docker Hub Description
  63. uses: peter-evans/dockerhub-description@v3
  64. with:
  65. username: wsmoogle
  66. password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  67. repository: weseek/growi-slackbot-proxy
  68. readme-filepath: ./apps/slackbot-proxy/docker/README.md
  69. create-pr-for-next-rc:
  70. needs: build-and-push-image
  71. runs-on: ubuntu-latest
  72. steps:
  73. - uses: actions/checkout@v4
  74. with:
  75. ref: ${{ github.event.pull_request.base.ref }}
  76. - uses: pnpm/action-setup@v4
  77. - uses: actions/setup-node@v4
  78. with:
  79. node-version: '18'
  80. cache: 'pnpm'
  81. - name: Install dependencies
  82. run: |
  83. pnpm add turbo --global
  84. pnpm install --frozen-lockfile
  85. - name: Bump versions for next RC
  86. run: |
  87. turbo run version:prerelease --filter=@growi/slackbot-proxy
  88. - name: Retrieve information from package.json
  89. uses: myrotvorets/info-from-package-json-action@v2.0.2
  90. id: package-json
  91. with:
  92. workingDir: apps/slackbot-proxy
  93. - name: Commit
  94. uses: github-actions-x/commit@v2.9
  95. with:
  96. github-token: ${{ secrets.GITHUB_TOKEN }}
  97. push-branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  98. commit-message: 'Bump version'
  99. name: GitHub Action
  100. - name: Create PR
  101. uses: repo-sync/pull-request@v2
  102. with:
  103. source_branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  104. destination_branch: master
  105. pr_title: Prepare v${{ steps.package-json.outputs.packageVersion }}
  106. pr_label: flag/exclude-from-changelog,type/prepare-next-version
  107. pr_body: "An automated PR generated by ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
  108. github_token: ${{ secrets.GITHUB_TOKEN }}