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.

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