release-slackbot-proxy.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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.1.0
  16. id: package-json
  17. with:
  18. workingDir: packages/slackbot-proxy
  19. - name: Docker meta
  20. id: meta
  21. uses: docker/metadata-action@v3
  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@v1
  32. with:
  33. registry: ghcr.io
  34. username: wsmoogle
  35. password: ${{ secrets.DOCKER_REGISTRY_ON_GITHUB_PASSWORD }}
  36. - name: Setup gcloud
  37. uses: google-github-actions/setup-gcloud@master
  38. with:
  39. project_id: ${{ secrets.GCP_PRJ_ID_SLACKBOT_PROXY }}
  40. service_account_key: ${{ secrets.GCP_SA_KEY_SLACKBOT_PROXY }}
  41. export_default_credentials: true
  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@v1
  47. - name: Cache Docker layers
  48. uses: actions/cache@v3
  49. with:
  50. path: /tmp/.buildx-cache
  51. key: ${{ runner.os }}-buildx-slackbot-proxy-${{ github.sha }}
  52. restore-keys: |
  53. ${{ runner.os }}-buildx-slackbot-proxy-
  54. - name: Build and push
  55. uses: docker/build-push-action@v2
  56. with:
  57. context: .
  58. file: ./packages/slackbot-proxy/docker/Dockerfile
  59. platforms: linux/amd64
  60. push: true
  61. cache-from: type=local,src=/tmp/.buildx-cache
  62. cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
  63. tags: ${{ steps.meta.outputs.tags }}
  64. - name: Move cache
  65. run: |
  66. rm -rf /tmp/.buildx-cache
  67. mv /tmp/.buildx-cache-new /tmp/.buildx-cache
  68. - name: Add tag
  69. uses: anothrNick/github-tag-action@1.36.0
  70. env:
  71. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  72. CUSTOM_TAG: v${{ steps.package-json.outputs.packageVersion }}
  73. VERBOSE : true
  74. - name: Update Docker Hub Description
  75. uses: peter-evans/dockerhub-description@v3
  76. with:
  77. username: wsmoogle
  78. password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
  79. repository: weseek/growi-slackbot-proxy
  80. readme-filepath: ./packages/slackbot-proxy/docker/README.md
  81. create-pr-for-next-rc:
  82. needs: build-and-push-image
  83. runs-on: ubuntu-latest
  84. steps:
  85. - uses: actions/checkout@v3
  86. with:
  87. ref: ${{ github.event.pull_request.base.ref }}
  88. - uses: actions/setup-node@v3
  89. with:
  90. node-version: '16'
  91. cache: 'yarn'
  92. cache-dependency-path: '**/yarn.lock'
  93. - name: Install dependencies
  94. run: |
  95. npx lerna bootstrap
  96. - name: Bump versions for next RC
  97. run: |
  98. yarn bump-versions:slackbot-proxy
  99. - name: Retrieve information from package.json
  100. uses: myrotvorets/info-from-package-json-action@1.1.0
  101. id: package-json
  102. with:
  103. workingDir: packages/slackbot-proxy
  104. - name: Commit
  105. uses: github-actions-x/commit@v2.8
  106. with:
  107. github-token: ${{ secrets.GITHUB_TOKEN }}
  108. push-branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  109. commit-message: 'Bump version'
  110. name: GitHub Action
  111. - name: Create PR
  112. uses: repo-sync/pull-request@v2
  113. with:
  114. source_branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
  115. destination_branch: master
  116. pr_title: Prepare v${{ steps.package-json.outputs.packageVersion }}
  117. pr_label: exclude from changelog
  118. pr_body: "An automated PR generated by ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
  119. github_token: ${{ secrets.GITHUB_TOKEN }}