release-slackbot-proxy.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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@v3
  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,ghcr.io/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: Login to GitHub Container Registry
  31. uses: docker/login-action@v2
  32. with:
  33. registry: ghcr.io
  34. username: wsmoogle
  35. password: ${{ secrets.DOCKER_REGISTRY_ON_GITHUB_PASSWORD }}
  36. - name: Authenticate to Google Cloud for GROWI.cloud
  37. uses: google-github-actions/auth@v1
  38. with:
  39. credentials_json: '${{ secrets.GCP_SA_KEY_SLACKBOT_PROXY }}'
  40. - name: Setup gcloud
  41. uses: google-github-actions/setup-gcloud@v1
  42. - name: Configure docker for gcloud
  43. run: |
  44. gcloud auth configure-docker --quiet
  45. - name: Set up Docker Buildx
  46. uses: docker/setup-buildx-action@v2
  47. - name: Build and push
  48. uses: docker/build-push-action@v4
  49. with:
  50. context: .
  51. file: ./apps/slackbot-proxy/docker/Dockerfile
  52. platforms: linux/amd64
  53. push: true
  54. builder: ${{ steps.buildx.outputs.name }}
  55. cache-from: type=gha
  56. cache-to: type=gha,mode=max
  57. tags: ${{ steps.meta.outputs.tags }}
  58. - name: Move cache
  59. run: |
  60. rm -rf /tmp/.buildx-cache
  61. mv /tmp/.buildx-cache-new /tmp/.buildx-cache
  62. - name: Add tag
  63. uses: anothrNick/github-tag-action@v1
  64. env:
  65. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  66. CUSTOM_TAG: v${{ steps.package-json.outputs.packageVersion }}
  67. VERBOSE : true
  68. - name: Update Docker Hub Description
  69. uses: peter-evans/dockerhub-description@v3
  70. with:
  71. username: wsmoogle
  72. password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  73. repository: weseek/growi-slackbot-proxy
  74. readme-filepath: ./apps/slackbot-proxy/docker/README.md
  75. create-pr-for-next-rc:
  76. needs: build-and-push-image
  77. runs-on: ubuntu-latest
  78. steps:
  79. - uses: actions/checkout@v3
  80. with:
  81. ref: ${{ github.event.pull_request.base.ref }}
  82. - uses: actions/setup-node@v3
  83. with:
  84. node-version: '16'
  85. cache: 'yarn'
  86. cache-dependency-path: '**/yarn.lock'
  87. - name: Install dependencies
  88. run: |
  89. npx lerna bootstrap
  90. - name: Bump versions for next RC
  91. run: |
  92. yarn bump-versions:slackbot-proxy
  93. - name: Retrieve information from package.json
  94. uses: myrotvorets/info-from-package-json-action@1.2.0
  95. id: package-json
  96. with:
  97. workingDir: apps/slackbot-proxy
  98. - name: Commit
  99. uses: github-actions-x/commit@v2.9
  100. with:
  101. github-token: ${{ secrets.GITHUB_TOKEN }}
  102. push-branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  103. commit-message: 'Bump version'
  104. name: GitHub Action
  105. - name: Create PR
  106. uses: repo-sync/pull-request@v2
  107. with:
  108. source_branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  109. destination_branch: master
  110. pr_title: Prepare v${{ steps.package-json.outputs.packageVersion }}
  111. pr_label: exclude from changelog
  112. pr_body: "An automated PR generated by ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
  113. github_token: ${{ secrets.GITHUB_TOKEN }}