Skip to content

feat: refactor locale selector & add it to welcome dialog #45 #132

feat: refactor locale selector & add it to welcome dialog #45

feat: refactor locale selector & add it to welcome dialog #45 #132

# https://github.com/EPFL-ENAC/epfl-enac-deploy-action#readme
name: build-push-deploy
"on":
push:
branches:
- dev
- main
tags: [ 'v*.*.*' ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{github.repository}}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- Dockerfile: ./Dockerfile
context: ./
image: ghcr.io/epfl-enac/sxl-recrete-atlas-frontend
permissions:
contents: read
packages: write
outputs:
github_sha: ${{ github.sha }}
digest: ${{ steps.build-docker-push.outputs.digest}}
tags: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ matrix.image }}
- name: Build and push Docker image EPFL-ENAC.Agent.Service
id: build-docker-push
uses: docker/build-push-action@v5
with:
context: ${{ matrix.context }}
push: true
file: ${{ matrix.dockerfile }}
tags: ${{ steps.meta.outputs.tags }},${{ matrix.image }}:${{ github.sha }},${{ matrix.image }}:latest
labels: ${{ steps.meta.outputs.labels }}
deploy:
needs: build-and-push-image
runs-on: ubuntu-latest
steps:
- name: what's the git ref
run: echo ${{ github.ref }} // ${{ github.ref_name }}
# This is used to trigger the correct github CI pipeline:
# push to main: update dev deployment
# push a tag: update stage, trigger prod merge req.
- name: Deploy application to dev
if: startsWith(github.ref, 'refs/heads/dev')
run: |
echo "Deploying application to dev" && \
echo "Digest: ${{ toJson(needs.build-and-push-image) }}" && \
curl -X POST \
-H "Authorization: Bearer ${{ secrets.CD_TOKEN }}" \
${{ secrets.CD_URI }} \
-d '{
"event_type": "update-manifest",
"client_payload": {
"digest": "${{ needs.build-and-push-image.outputs.digest }}",
"repo_name": "${{ secrets.CD_REPO }}",
"repo_org": "${{ secrets.CD_ORG }}",
"branch": "dev"
}
}'
- name: Deploy to prod rules (defined in CD pipeline)
if: startsWith(github.ref, 'refs/tags/')
run: |
curl -X POST \
-H "Authorization: Bearer ${{ secrets.CD_TOKEN }}" \
${{ secrets.CD_URI }} \
-d '{
"event_type": "update-manifest",
"client_payload": {
"digest": "${{ needs.build-and-push-image.outputs.digest }}",
"repo_name": "${{ secrets.CD_REPO }}",
"repo_org": "${{ secrets.CD_ORG }}",
"branch": "prod",
"ref_name": "${{ github.ref_name }}"
}
}'