Skip to content

Merge pull request #52 from MGdaasLab/v2.1.0 #45

Merge pull request #52 from MGdaasLab/v2.1.0

Merge pull request #52 from MGdaasLab/v2.1.0 #45

Workflow file for this run

name: Build and Push Docker Images
on:
push:
branches:
- master
env:
REGISTRY: ghcr.io
IMAGE_BACKEND: ghcr.io/${{ github.repository_owner }}/wharttest-backend
IMAGE_FRONTEND: ghcr.io/${{ github.repository_owner }}/wharttest-frontend
IMAGE_MCP: ghcr.io/${{ github.repository_owner }}/wharttest-mcp
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for backend
id: meta-backend
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_BACKEND }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Extract metadata for frontend
id: meta-frontend
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_FRONTEND }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Extract metadata for MCP
id: meta-mcp
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_MCP }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push backend image
uses: docker/build-push-action@v5
with:
context: ./WHartTest_Django
file: ./WHartTest_Django/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-backend.outputs.tags }}
labels: ${{ steps.meta-backend.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push frontend image
uses: docker/build-push-action@v5
with:
context: ./WHartTest_Vue
file: ./WHartTest_Vue/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-frontend.outputs.tags }}
labels: ${{ steps.meta-frontend.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push MCP image
uses: docker/build-push-action@v5
with:
context: ./WHartTest_MCP
file: ./WHartTest_MCP/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-mcp.outputs.tags }}
labels: ${{ steps.meta-mcp.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Image digest
run: |
echo "Backend: ${{ steps.meta-backend.outputs.tags }}"
echo "Frontend: ${{ steps.meta-frontend.outputs.tags }}"
echo "MCP: ${{ steps.meta-mcp.outputs.tags }}"