55 lines
1.5 KiB
YAML
55 lines
1.5 KiB
YAML
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: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build Docker image and push to Docker Hub
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ secrets.DOCKERHUB_USERNAME }}/$IMAGE_NAME:latest
|
|
context: ./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
|