release-slackbot-proxy.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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@v6
  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: Add tag
  53. uses: anothrNick/github-tag-action@v1
  54. env:
  55. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  56. CUSTOM_TAG: v${{ steps.package-json.outputs.packageVersion }}
  57. VERBOSE : true
  58. - name: Update Docker Hub Description
  59. uses: peter-evans/dockerhub-description@v4
  60. with:
  61. username: wsmoogle
  62. password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  63. repository: weseek/growi-slackbot-proxy
  64. readme-filepath: ./apps/slackbot-proxy/docker/README.md
  65. create-pr-for-next-rc:
  66. needs: build-and-push-image
  67. runs-on: ubuntu-latest
  68. steps:
  69. - uses: actions/checkout@v4
  70. with:
  71. ref: ${{ github.event.pull_request.base.ref }}
  72. - uses: pnpm/action-setup@v4
  73. - uses: actions/setup-node@v4
  74. with:
  75. node-version: '18'
  76. cache: 'pnpm'
  77. - name: Install dependencies
  78. run: |
  79. pnpm add turbo --global
  80. pnpm install --frozen-lockfile
  81. - name: Bump versions for next RC
  82. run: |
  83. turbo run version:prerelease --filter=@growi/slackbot-proxy
  84. - name: Retrieve information from package.json
  85. uses: myrotvorets/info-from-package-json-action@v2.0.2
  86. id: package-json
  87. with:
  88. workingDir: apps/slackbot-proxy
  89. - name: Commit
  90. uses: github-actions-x/commit@v2.9
  91. with:
  92. github-token: ${{ secrets.GITHUB_TOKEN }}
  93. push-branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  94. commit-message: 'Bump version'
  95. name: GitHub Action
  96. - name: Create PR
  97. uses: repo-sync/pull-request@v2
  98. with:
  99. source_branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  100. destination_branch: master
  101. pr_title: Prepare v${{ steps.package-json.outputs.packageVersion }}
  102. pr_label: flag/exclude-from-changelog,type/prepare-next-version
  103. pr_body: "An automated PR generated by ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
  104. github_token: ${{ secrets.GITHUB_TOKEN }}