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.

55 lines
1.8 KiB

  1. name: Build & Push
  2. # Build & Push rebuilds the tendermint docker image on every push to master and creation of tags
  3. # and pushes the image to https://hub.docker.com/r/interchainio/simapp/tags
  4. on:
  5. push:
  6. branches:
  7. - master
  8. tags:
  9. - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10
  10. - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5
  11. jobs:
  12. build:
  13. runs-on: ubuntu-latest
  14. steps:
  15. - uses: actions/checkout@master
  16. - name: Prepare
  17. id: prep
  18. run: |
  19. DOCKER_IMAGE=tendermint/tendermint
  20. VERSION=noop
  21. if [[ $GITHUB_REF == refs/tags/* ]]; then
  22. VERSION=${GITHUB_REF#refs/tags/}
  23. elif [[ $GITHUB_REF == refs/heads/* ]]; then
  24. VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
  25. if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then
  26. VERSION=latest
  27. fi
  28. fi
  29. TAGS="${DOCKER_IMAGE}:${VERSION}"
  30. if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
  31. TAGS="$TAGS,${DOCKER_IMAGE}:${VERSION}"
  32. fi
  33. echo ::set-output name=tags::${TAGS}
  34. - name: Set up Docker Buildx
  35. uses: docker/setup-buildx-action@v1
  36. - name: Login to DockerHub
  37. uses: docker/login-action@v1
  38. with:
  39. username: ${{ secrets.DOCKERHUB_USERNAME }}
  40. password: ${{ secrets.DOCKERHUB_TOKEN }}
  41. - name: Build Tendermint
  42. run: |
  43. make build-linux && cp build/tendermint DOCKER/tendermint
  44. - name: Publish to Docker Hub
  45. uses: docker/build-push-action@v2
  46. with:
  47. context: ./DOCKER
  48. file: ./DOCKER/Dockerfile
  49. push: ${{ github.event_name != 'pull_request' }}
  50. tags: ${{ steps.prep.outputs.tags }}