Skip to content

Change decimals and KSM to DOT #99

Change decimals and KSM to DOT

Change decimals and KSM to DOT #99

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
IMAGE_NAME: paritytech/ahmm
APP: asset-hub-migration-monitor
jobs:
set-variables:
name: Set variables
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.version.outputs.VERSION }}
steps:
- name: Define version
id: version
run: |
export COMMIT_SHA=${{ github.sha }}
export COMMIT_SHA_SHORT=${COMMIT_SHA:0:8}
export REF_NAME=${{ github.ref_name }}
export REF_SLUG=${REF_NAME//\//_}
echo "short sha: ${COMMIT_SHA_SHORT} slug: ${REF_SLUG}"
if [[ ${REF_SLUG} == "main" ]]
then
export VERSION=${REF_SLUG}-${COMMIT_SHA_SHORT}
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
else
export VERSION=${REF_SLUG}
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
fi
echo "set VERSION=${VERSION}"
docker-build:
runs-on: ubuntu-latest
timeout-minutes: 10
environment: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'prod' || null }}
needs: [set-variables]
strategy:
fail-fast: false
matrix:
app:
- frontend
- backend
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to dockerhub
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push Docker image from main
uses: docker/build-push-action@v5
with:
context: ${{ matrix.app }}
file: ./${{ matrix.app }}/Dockerfile
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
tags: |
${{ env.IMAGE_NAME }}-${{ matrix.app }}:${{ needs.set-variables.outputs.VERSION }}
deploy-stg:
name: Deploy Staging
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: [set-variables, docker-build]
permissions:
contents: "read"
id-token: "write"
environment: stg
env:
VERSION: ${{ needs.set-variables.outputs.VERSION }}
ARGOCD_SERVER: "argocd-stg.teleport.parity.io"
steps:
- name: Deploy to ArgoCD
uses: paritytech/argocd-deployment-action@main
with:
environment: "parity-stg"
tag: "${{ env.VERSION }}"
app_name: "${{ env.APP }}"
app_packages: "frontend,backend"
argocd_server: ${{ env.ARGOCD_SERVER }}
teleport_token: ${{ env.APP }}
teleport_app_name: "argocd-stg"
argocd_auth_token: ${{ secrets.ARGOCD_AUTH_TOKEN }}
argocd_auto_sync_disabled: "false"
deploy-prod:
name: Deploy Production
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: [set-variables, docker-build, deploy-stg]
permissions:
contents: "read"
id-token: "write"
environment: prod
env:
VERSION: ${{ needs.set-variables.outputs.VERSION }}
ARGOCD_SERVER: "argocd-prod.teleport.parity.io"
steps:
- name: Deploy to ArgoCD
uses: paritytech/argocd-deployment-action@main
with:
environment: "parity-prod"
tag: "${{ env.VERSION }}"
app_name: "${{ env.APP }}"
app_packages: "frontend,backend"
argocd_server: ${{ env.ARGOCD_SERVER }}
teleport_token: ${{ env.APP }}
teleport_app_name: "argocd-prod"
argocd_auth_token: ${{ secrets.ARGOCD_AUTH_TOKEN }}
argocd_auto_sync_disabled: "false"