Skip to content

Merge pull request #190 from Lemoncode/Feature/add-cache-and-revalidate #49

Merge pull request #190 from Lemoncode/Feature/add-cache-and-revalidate

Merge pull request #190 from Lemoncode/Feature/add-cache-and-revalidate #49

Workflow file for this run

name: Deploy Front (Next.js) to Azure App Service (GHCR)
on:
push:
branches: ["main"]
paths:
- "front/**"
- "packages/db-model/**"
- "package.json"
- "package-lock.json"
concurrency:
group: front-prod
cancel-in-progress: true
permissions:
contents: read
packages: write
env:
IMAGE_NAME: ghcr.io/lemoncode/embalse-info-front
IMAGE_TAG: latest
IMAGE_SHA_TAG: sha-${{ github.sha }}
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# Checkout repository source code
- name: Checkout
uses: actions/checkout@v4
# Login to GHCR (GitHub Container Registry)
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Setup Docker Buildx (better caching/build support)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Build and push the Docker image
- name: Build and Push
uses: docker/build-push-action@v6
with:
context: .
file: front/Dockerfile
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
${{ env.IMAGE_NAME }}:${{ env.IMAGE_SHA_TAG }}
# Deploy the image to Azure App Service (Linux container)
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v3
with:
app-name: ${{ secrets.AZURE_FRONT_APP_NAME }}
publish-profile: ${{ secrets.AZURE_FRONT_PUBLISH_PROFILE }}
images: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_SHA_TAG }}
restart: true