on: push
name: Docker build and push
jobs:
  build:
    name: Docker build and push
    if: '!github.event.deleted'
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: '0'
    - name: Bump version and push tag
      if: github.ref == 'refs/heads/master'
      uses: anothrNick/github-tag-action@master
      id: version
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        WITH_V: true
        DEFAULT_BUMP: patch
    - name: Build and push Docker images
      uses: docker/build-push-action@v2
      with:
        username: ${{ secrets.DOCKER_USERNAME }}
        password: ${{ secrets.DOCKER_TOKEN }}
        # Assume the same repo name on Docker Hub as on GitHub
        repository: ${{ github.repository }}
        tags: ${{ steps.version.outputs.new_tag }}
        tag_with_ref: true
        add_git_labels: true

on: push
name: Docker build and push
jobs:
  build:
    name: Docker build and push
    if: '!github.event.deleted'
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: '0'
    - name: Bump version and push tag
      if: github.ref == 'refs/heads/master'
      uses: anothrNick/github-tag-action@master
      id: version
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        WITH_V: true
        DEFAULT_BUMP: patch
    - name: Set up Docker Buildx
      id: buildx
      uses: docker/setup-buildx-action@master
    - name: Login to DockerHub
      if: github.ref == 'refs/heads/master'
      uses: docker/login-action@v1
      with:
        username: ${{ secrets.DOCKER_USERNAME }}
        password: ${{ secrets.DOCKER_TOKEN }}
    - name: Build and push Docker images
      if: github.ref == 'refs/heads/master'
      uses: docker/build-push-action@v2
      with:
        builder: ${{ steps.buildx.outputs.name }}
        tags: |
          spejder/msml:latest
          spejder/msml:${{ steps.version.outputs.new_tag }}
        push: true

Update docker build and push action to v2 syntax
Update docker build and push action to v2 syntax
