Merge pull request #199 from seanmorley15/development #71
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Upload latest frontend image to GHCR and Docker Hub | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "frontend/**" | |
env: | |
IMAGE_NAME: "adventurelog-frontend" | |
jobs: | |
upload: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.ACCESS_TOKEN }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build Docker image | |
run: docker build -t $IMAGE_NAME:latest ./frontend | |
- name: Tag Docker image for GHCR | |
run: docker tag $IMAGE_NAME:latest ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:latest | |
- name: Tag Docker image for Docker Hub | |
run: docker tag $IMAGE_NAME:latest ${{ secrets.DOCKERHUB_USERNAME }}/$IMAGE_NAME:latest | |
- name: Push Docker image to GHCR | |
run: docker push ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:latest | |
- name: Push Docker image to Docker Hub | |
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/$IMAGE_NAME:latest |