You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.9 KiB

  1. # This workflow (re)builds and pushes a Docker image containing the
  2. # protobuf build tools used by the other workflows.
  3. #
  4. # When making changes that require updates to the builder image, you
  5. # should merge the updates first and wait for this workflow to complete,
  6. # so that the changes will be available for the dependent workflows.
  7. #
  8. name: Build & Push Proto Builder Image
  9. on:
  10. pull_request:
  11. paths:
  12. - "proto/*"
  13. push:
  14. branches:
  15. - master
  16. paths:
  17. - "proto/*"
  18. schedule:
  19. # run this job once a month to recieve any go or buf updates
  20. - cron: "0 9 1 * *"
  21. env:
  22. REGISTRY: ghcr.io
  23. IMAGE_NAME: tendermint/docker-build-proto
  24. jobs:
  25. build:
  26. runs-on: ubuntu-latest
  27. steps:
  28. - uses: actions/checkout@v2.4.0
  29. - name: Check out and assign tags
  30. id: prep
  31. run: |
  32. DOCKER_IMAGE="${REGISTRY}/${IMAGE_NAME}"
  33. VERSION=noop
  34. if [[ "$GITHUB_REF" == "refs/tags/*" ]]; then
  35. VERSION="${GITHUB_REF#refs/tags/}"
  36. elif [[ "$GITHUB_REF" == "refs/heads/*" ]]; then
  37. VERSION="$(echo "${GITHUB_REF#refs/heads/}" | sed -r 's#/+#-#g')"
  38. if [[ "${{ github.event.repository.default_branch }}" = "$VERSION" ]]; then
  39. VERSION=latest
  40. fi
  41. fi
  42. TAGS="${DOCKER_IMAGE}:${VERSION}"
  43. echo ::set-output name=tags::"${TAGS}"
  44. - name: Set up docker buildx
  45. uses: docker/setup-buildx-action@v1.6.0
  46. - name: Log in to the container registry
  47. uses: docker/login-action@v1.12.0
  48. with:
  49. registry: ${{ env.REGISTRY }}
  50. username: ${{ github.actor }}
  51. password: ${{ secrets.GITHUB_TOKEN }}
  52. - name: Build and publish image
  53. uses: docker/build-push-action@v2.9.0
  54. with:
  55. context: ./proto
  56. file: ./proto/Dockerfile
  57. push: ${{ github.event_name != 'pull_request' }}
  58. tags: ${{ steps.prep.outputs.tags }}