name: Build phonebook

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:

  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Build the Docker image
      run: docker build . --file Dockerfile --tag ghcr.io/belowaverage-org/phonebook:latest
      
    - name: Login
      run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u krisdb2009 --password-stdin

    - name: Publish the Docker image
      run: docker push ghcr.io/belowaverage-org/phonebook:latest
