Deploy Dependencies on staging #57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Dependencies | |
| run-name: Deploy Dependencies on ${{ inputs.environment }} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: "Target environment" | |
| required: true | |
| default: "dev" | |
| type: choice | |
| options: | |
| - demo1 | |
| - production | |
| - staging | |
| jobs: | |
| approve: | |
| environment: ${{ inputs.environment }} | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Waiting for manual approval | |
| if: ${{ (vars.APPROVAL_REQUIRED || 'false') == 'true' }} | |
| uses: trstringer/manual-approval@v1 | |
| with: | |
| secret: ${{ github.TOKEN }} | |
| approvers: ${{ vars.GH_APPROVERS }} | |
| minimum-approvals: 1 | |
| issue-title: > | |
| Deploy (${{ inputs.environment }}): core: ${{ inputs.core-image-tag }} | |
| country config: ${{ inputs.countryconfig-image-tag }} | |
| issue-body: > | |
| Please approve or deny the deployment of core: ${{ inputs.core-image-tag }} | |
| country config: ${{ inputs.countryconfig-image-tag }} to ${{ inputs.environment }} | |
| exclude-workflow-initiator-as-approver: false | |
| github-to-k8s-sync-env: | |
| needs: approve | |
| uses: ./.github/workflows/github-to-k8s-sync-env.yml | |
| with: | |
| environment: ${{ inputs.environment }} | |
| mapping_file: "deps" | |
| secrets: inherit | |
| deploy: | |
| needs: 'github-to-k8s-sync-env' | |
| environment: ${{ inputs.environment }} | |
| runs-on: | |
| - self-hosted | |
| - k8s | |
| - ${{ inputs.environment }} | |
| env: | |
| ENV: ${{ inputs.environment }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Install Traefik | |
| run: | | |
| kubectl scale deployment traefik --replicas=0 --namespace traefik || true | |
| helm upgrade --install traefik oci://ghcr.io/traefik/helm/traefik \ | |
| --namespace traefik \ | |
| --create-namespace \ | |
| -f environments/${ENV}/traefik/values.yaml | |
| kubectl scale deployment traefik --replicas=1 --namespace traefik | |
| - name: Install OpenCRVS dependencies | |
| run: | | |
| helm upgrade --install opencrvs-deps oci://ghcr.io/opencrvs/opencrvs-dependencies-chart \ | |
| --namespace "opencrvs-deps-${ENV}" \ | |
| -f environments/${ENV}/dependencies/values.yaml \ | |
| --create-namespace \ | |
| --set hostname=${{ vars.DOMAIN }} \ | |
| --atomic |