name: Docker

on:
  push:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - name: Docker Login
      uses: azure/docker-login@v1
      with:
        login-server: docker.pkg.github.com
        username: $GITHUB_ACTOR
        password: ${{ secrets.GITHUB_TOKEN }}

    - name: Build the Docker image
      run: |
        VERSION=$(git describe --always --long --dirty --tags)
        docker build . --tag docker.pkg.github.com/mdiluz/rove/rove:$VERSION --tag docker.pkg.github.com/mdiluz/rove/rove:latest
        docker push docker.pkg.github.com/mdiluz/rove/rove:$VERSION
        docker push docker.pkg.github.com/mdiluz/rove/rove:latest
