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.

58 lines
1.9 KiB

  1. name: Docker
  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@v2.3.4
  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 QEMU
  35. uses: docker/setup-qemu-action@master
  36. with:
  37. platforms: all
  38. - name: Set up Docker Build
  39. uses: docker/setup-buildx-action@v1.6.0
  40. - name: Login to DockerHub
  41. if: ${{ github.event_name != 'pull_request' }}
  42. uses: docker/login-action@v1.10.0
  43. with:
  44. username: ${{ secrets.DOCKERHUB_USERNAME }}
  45. password: ${{ secrets.DOCKERHUB_TOKEN }}
  46. - name: Publish to Docker Hub
  47. uses: docker/build-push-action@v2.7.0
  48. with:
  49. context: .
  50. file: ./DOCKER/Dockerfile
  51. platforms: linux/amd64,linux/arm64
  52. push: ${{ github.event_name != 'pull_request' }}
  53. tags: ${{ steps.prep.outputs.tags }}