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@1.2.0
  16. id: package-json
  17. with:
  18. workingDir: apps/slackbot-proxy
  19. - name: Docker meta
  20. id: meta
  21. uses: docker/metadata-action@v4
  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@v1
  32. with:
  33. credentials_json: '${{ secrets.GCP_SA_KEY_SLACKBOT_PROXY }}'
  34. - name: Setup gcloud
  35. uses: google-github-actions/setup-gcloud@v1
  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@v2
  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: actions/setup-node@v4
  77. with:
  78. node-version: '18'
  79. cache: 'yarn'
  80. cache-dependency-path: '**/yarn.lock'
  81. - name: Install dependencies
  82. run: |
  83. yarn global add turbo
  84. yarn global add node-gyp
  85. yarn --frozen-lockfile
  86. - name: Bump versions for next RC
  87. run: |
  88. turbo run version --filter=@growi/slackbot-proxy -- --prerelease
  89. - name: Retrieve information from package.json
  90. uses: myrotvorets/info-from-package-json-action@1.2.0
  91. id: package-json
  92. with:
  93. workingDir: apps/slackbot-proxy
  94. - name: Commit
  95. uses: github-actions-x/commit@v2.9
  96. with:
  97. github-token: ${{ secrets.GITHUB_TOKEN }}
  98. push-branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  99. commit-message: 'Bump version'
  100. name: GitHub Action
  101. - name: Create PR
  102. uses: repo-sync/pull-request@v2
  103. with:
  104. source_branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  105. destination_branch: master
  106. pr_title: Prepare v${{ steps.package-json.outputs.packageVersion }}
  107. pr_label: flag/exclude-from-changelog,type/prepare-next-version
  108. pr_body: "An automated PR generated by ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
  109. github_token: ${{ secrets.GITHUB_TOKEN }}