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.

51 lines
1.5 KiB

  1. name: Build & Push TM Proto Builder
  2. on:
  3. pull_request:
  4. paths:
  5. - "tools/proto/*"
  6. push:
  7. branches:
  8. - master
  9. paths:
  10. - "tools/proto/*"
  11. schedule:
  12. # run this job once a month to recieve any go or buf updates
  13. - cron: "* * 1 * *"
  14. jobs:
  15. build:
  16. runs-on: ubuntu-latest
  17. steps:
  18. - uses: actions/checkout@v2.3.4
  19. - name: Prepare
  20. id: prep
  21. run: |
  22. DOCKER_IMAGE=tendermintdev/docker-build-proto
  23. VERSION=noop
  24. if [[ $GITHUB_REF == refs/tags/* ]]; then
  25. VERSION=${GITHUB_REF#refs/tags/}
  26. elif [[ $GITHUB_REF == refs/heads/* ]]; then
  27. VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
  28. if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then
  29. VERSION=latest
  30. fi
  31. fi
  32. TAGS="${DOCKER_IMAGE}:${VERSION}"
  33. echo ::set-output name=tags::${TAGS}
  34. - name: Set up Docker Buildx
  35. uses: docker/setup-buildx-action@v1.3.0
  36. - name: Login to DockerHub
  37. uses: docker/login-action@v1.9.0
  38. with:
  39. username: ${{ secrets.DOCKERHUB_USERNAME }}
  40. password: ${{ secrets.DOCKERHUB_TOKEN }}
  41. - name: Publish to Docker Hub
  42. uses: docker/build-push-action@v2.4.0
  43. with:
  44. context: ./tools/proto
  45. file: ./tools/proto/Dockerfile
  46. push: ${{ github.event_name != 'pull_request' }}
  47. tags: ${{ steps.prep.outputs.tags }}