Skip to content

Merge branch '1558-unpopulated-point-sub-element-causing-error-in-act… #427

Merge branch '1558-unpopulated-point-sub-element-causing-error-in-act…

Merge branch '1558-unpopulated-point-sub-element-causing-error-in-act… #427

name: Staging Deployment
on:
push:
branches: [ staging ]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
cli_build_push:
name: cli image build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/cli
- name: Build and push Docker image
uses: docker/build-push-action@1ca370b3a9802c92e886402e0dd88098a2533b12
with:
context: .
file: Dockerfile.staging
push: true
target: cli
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/cli:${{ github.sha }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/cli:latest
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
MIX_ENCRYPTION_KEY=${{ secrets.MIX_ENCRYPTION_KEY_STAGING }}
fpm_server_build_push:
name: fpm_server image build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/fpm_server
- name: Build and push Docker image
uses: docker/build-push-action@1ca370b3a9802c92e886402e0dd88098a2533b12
with:
context: .
file: Dockerfile.staging
push: true
target: fpm_server
build-args: |
MIX_ENCRYPTION_KEY=${{ secrets.MIX_ENCRYPTION_KEY_STAGING }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/fpm_server:${{ github.sha }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/fpm_server:latest
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
web_server_build_push:
name: web_server image build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/web_server
- name: Build and push Docker image
uses: docker/build-push-action@1ca370b3a9802c92e886402e0dd88098a2533b12
with:
context: .
push: true
target: web_server
file: Dockerfile.staging
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/web_server:${{ github.sha }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/web_server:latest
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
MIX_ENCRYPTION_KEY=${{ secrets.MIX_ENCRYPTION_KEY_STAGING }}
cron_build_push:
name: cron image build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/cron
- name: Build and push Docker image
uses: docker/build-push-action@1ca370b3a9802c92e886402e0dd88098a2533b12
with:
context: .
file: Dockerfile.staging
push: true
target: cron
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/cron:${{ github.sha }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/cron:latest
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
MIX_ENCRYPTION_KEY=${{ secrets.MIX_ENCRYPTION_KEY_STAGING }}
horizon_build_push:
name: horizon image build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/horizon
- name: Build and push Docker image
uses: docker/build-push-action@1ca370b3a9802c92e886402e0dd88098a2533b12
with:
context: .
file: Dockerfile.staging
push: true
target: horizon
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/horizon:${{ github.sha }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/horizon:latest
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
MIX_ENCRYPTION_KEY=${{ secrets.MIX_ENCRYPTION_KEY_STAGING }}
deploy-staging:
name: staging deploy
runs-on: ubuntu-latest
environment:
name: staging
url: https://iatipublisher-staging.yipl.com.np
needs: [cli_build_push, fpm_server_build_push, web_server_build_push, cron_build_push, horizon_build_push]
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: imranismail/setup-kustomize@v2
- name: update k8s
run: |
cd packages/staging
kustomize edit set image ghcr.io/${{ github.repository }}/cli:${{ github.sha }}
kustomize edit set image ghcr.io/${{ github.repository }}/fpm_server:${{ github.sha }}
kustomize edit set image ghcr.io/${{ github.repository }}/web_server:${{ github.sha }}
kustomize edit set image ghcr.io/${{ github.repository }}/cron:${{ github.sha }}
kustomize edit set image ghcr.io/${{ github.repository }}/horizon:${{ github.sha }}
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Save DigitalOcean kubeconfig with short-lived credentials
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 de2f7af9-3d20-4f8d-a661-7f69092d4520
- name: Deploy to DigitalOcean Kubernetes
run: kubectl apply -k packages/staging