release-slackbot-proxy.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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@v2
  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@0.0.2
  16. id: package-json
  17. - name: Docker meta
  18. id: meta
  19. uses: docker/metadata-action@v3
  20. with:
  21. images: weseek/growi-slackbot-proxy,ghcr.io/weseek/growi-slackbot-proxy,asia.gcr.io/${{ secrets.GCP_PRJ_ID_SLACKBOT_PROXY }}/growi-slackbot-proxy
  22. tags: |
  23. type=raw,value=latest
  24. type=raw,value=${{ steps.package-json.outputs.packageVersion }}
  25. - name: Login to docker.io registry
  26. run: |
  27. echo ${{ secrets. DOCKER_REGISTRY_PASSWORD }} | docker login --username wsmoogle --password-stdin
  28. - name: Login to GitHub Container Registry
  29. uses: docker/login-action@v1
  30. with:
  31. registry: ghcr.io
  32. username: wsmoogle
  33. password: ${{ secrets.DOCKER_REGISTRY_ON_GITHUB_PASSWORD }}
  34. - name: Setup gcloud
  35. uses: google-github-actions/setup-gcloud@master
  36. with:
  37. project_id: ${{ secrets.GCP_PRJ_ID_SLACKBOT_PROXY }}
  38. service_account_key: ${{ secrets.GCP_SA_KEY_SLACKBOT_PROXY }}
  39. export_default_credentials: true
  40. - name: Configure docker for gcloud
  41. run: |
  42. gcloud auth configure-docker --quiet
  43. - name: Set up Docker Buildx
  44. uses: docker/setup-buildx-action@v1
  45. - name: Cache Docker layers
  46. uses: actions/cache@v2
  47. with:
  48. path: /tmp/.buildx-cache
  49. key: ${{ runner.os }}-buildx-slackbot-proxy-${{ github.sha }}
  50. restore-keys: |
  51. ${{ runner.os }}-buildx-slackbot-proxy-
  52. - name: Build and push
  53. uses: docker/build-push-action@v2
  54. with:
  55. context: .
  56. file: ./packages/slackbot-proxy/docker/Dockerfile
  57. platforms: linux/amd64
  58. push: true
  59. cache-from: type=local,src=/tmp/.buildx-cache
  60. cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
  61. tags: ${{ steps.meta.outputs.tags }}
  62. - name: Move cache
  63. run: |
  64. rm -rf /tmp/.buildx-cache
  65. mv /tmp/.buildx-cache-new /tmp/.buildx-cache
  66. - name: Update Docker Hub Description
  67. uses: peter-evans/dockerhub-description@v2
  68. with:
  69. username: wsmoogle
  70. password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  71. repository: weseek/growi-slackbot-proxy
  72. readme-filepath: ./packages/slackbot-proxy/docker/README.md