name: Deploy-To-Docker

on: [push]
#  push:
#    tags:
#    - '*'

jobs:
  build:

    runs-on: ${{ matrix.os }}
    strategy:
      max-parallel: 4
      matrix:
        os: [ubuntu-latest]

    steps:
    - uses: actions/checkout@v1
    - name: Build image
      run: |
        docker build -t chrismit7/pyquant:latest .
        docker tag chrismit7/pyquant:latest chrismit7/pyquant:${GITHUB_REF#refs/heads/}
    - name: Upload image to Dockerhub
      env:
        DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
      if: matrix.os == 'ubuntu-latest'
      run: |
        docker login --username chrismit7 -p ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
        docker push chrismit7/pyquant:latest
        docker push chrismit7/pyquant:${GITHUB_REF#refs/heads/}

name: Deploy-To-Docker

on:
  push:
    tags:
    - '*'

jobs:
  build:

    runs-on: ${{ matrix.os }}
    strategy:
      max-parallel: 4
      matrix:
        os: [ubuntu-latest]

    steps:
    - uses: actions/checkout@v1
    - name: Build image
      run: |
        docker build -t chrismit7/pyquant:latest .
        docker tag chrismit7/pyquant:latest chrismit7/pyquant:${GITHUB_REF#refs/heads/}
    - name: Upload image to Dockerhub
      env:
        DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
      if: matrix.os == 'ubuntu-latest'
      run: |
        docker login --username chrismit7 -p ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
        docker push chrismit7/pyquant:latest
        docker push chrismit7/pyquant:${GITHUB_REF#refs/heads/}

Deploy to docker only on tags
Deploy to docker only on tags
