name: Docker

on:
  push:
    branches:
      - main

env:
  IMAGE_NAME: toolbox

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Build image
        run:
            docker build -t $IMAGE_NAME .

      - name: Log into github registry
        run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin

      - name: Push image to github registry
        run: |
          IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME

          docker tag $IMAGE_NAME $IMAGE_ID:latest
          docker tag $IMAGE_NAME $IMAGE_ID:${{ github.sha }}
          docker push $IMAGE_ID:latest
          docker push $IMAGE_ID:${{ github.sha }}

      - name: Log into docker hub registry
        run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u apexskier --password-stdin

      - name: Push image to docker hub registry
        run: |
          IMAGE_ID=apexskier/$IMAGE_NAME

          docker tag $IMAGE_NAME $IMAGE_ID:latest
          docker tag $IMAGE_NAME $IMAGE_ID:${{ github.sha }}
          docker push $IMAGE_ID:latest
          docker push $IMAGE_ID:${{ github.sha }}

name: Docker

on:
  push:
    branches:
      - main

env:
  IMAGE_NAME: toolbox

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Build image
        run:
            docker build -t $IMAGE_NAME .

      - name: Log into github registry
        run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

      - name: Push image to github registry
        run: |
          IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME

          docker tag $IMAGE_NAME $IMAGE_ID:latest
          docker tag $IMAGE_NAME $IMAGE_ID:${{ github.sha }}
          docker push $IMAGE_ID:latest
          docker push $IMAGE_ID:${{ github.sha }}

      - name: Log into docker hub registry
        run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u apexskier --password-stdin

      - name: Push image to docker hub registry
        run: |
          IMAGE_ID=apexskier/$IMAGE_NAME

          docker tag $IMAGE_NAME $IMAGE_ID:latest
          docker tag $IMAGE_NAME $IMAGE_ID:${{ github.sha }}
          docker push $IMAGE_ID:latest
          docker push $IMAGE_ID:${{ github.sha }}

Migrate to new container registry
Migrate to new container registry
