# This workflow builds and pushes a new version of the build container image # when the tools directory changes on master. Edit tools/Dockerfile. # # This workflow does not push a new image until it is merged, so tests that # depend on changes in this image will not pass until this workflow succeeds. # For that reason, changes here should be done in a separate PR in advance of # work that depends on them. name: Build & Push TM-DB-Testing on: pull_request: paths: - "tools/*" push: branches: - master paths: - "tools/*" jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Prepare id: prep run: | DOCKER_IMAGE=tendermintdev/docker-tm-db-testing VERSION=noop if [[ $GITHUB_REF == refs/tags/* ]]; then VERSION=${GITHUB_REF#refs/tags/} elif [[ $GITHUB_REF == refs/heads/* ]]; then VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g') if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then VERSION=latest fi fi TAGS="${DOCKER_IMAGE}:${VERSION}" echo ::set-output name=tags::${TAGS} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to DockerHub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Publish to Docker Hub uses: docker/build-push-action@v3 with: context: ./tools file: ./tools/Dockerfile push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.prep.outputs.tags }}