Skip to content

Deploy

Deploy #18

Workflow file for this run

name: Deploy
on:
workflow_dispatch:
inputs:
version:
description: Version
required: true
environment:
description: Environment
required: true
type: choice
options:
- dev
- test
- stage
- training
- preprod
- prod
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- uses: actions/checkout@v4
- name: Authenticate
run: |
echo "$KUBE_CERT" > ca.crt
kubectl config set-cluster "$KUBE_CLUSTER" --certificate-authority=./ca.crt --server="$KUBE_ENV_API"
kubectl config set-credentials cd-serviceaccount --token="$KUBE_TOKEN"
kubectl config set-context "$KUBE_CLUSTER" --cluster="$KUBE_CLUSTER" --user=cd-serviceaccount --namespace="$KUBE_NAMESPACE"
kubectl config use-context "$KUBE_CLUSTER"
env:
KUBE_ENV_API: ${{ secrets.KUBE_ENV_API }}
KUBE_CERT: ${{ secrets.KUBE_CERT }}
KUBE_CLUSTER: ${{ secrets.KUBE_CLUSTER }}
KUBE_NAMESPACE: ${{ secrets.KUBE_NAMESPACE }}
KUBE_TOKEN: ${{ secrets.KUBE_TOKEN }}
- name: Install dependencies
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install helm
helm dependency update helm_deploy
- name: Deploy
run: |
yq -i ".appVersion = \"$VERSION\"" "helm_deploy/Chart.yaml"
helm upgrade "$CHART_NAME" helm_deploy \
--atomic \
--history-max 10 \
--force \
--install \
--reset-values \
--set "version=$VERSION" \
--set "generic-service.image.tag=$VERSION" \
--set "generic-service.env.VERSION=$VERSION" \
--timeout 10m \
--values <(base64 -d <<< "$HMPPS_IP_ALLOWLIST_GROUPS_YAML") \
--values "helm_deploy/values.yaml" \
--values "helm_deploy/values-$ENVIRONMENT.yaml" \
--wait
env:
CHART_NAME: delius-user-management
ENVIRONMENT: ${{ inputs.environment }}
VERSION: ${{ inputs.version }}
GITHUB_TOKEN: ${{ github.token }}
HMPPS_IP_ALLOWLIST_GROUPS_YAML: ${{ vars.HMPPS_IP_ALLOWLIST_GROUPS_YAML }}