Skip to content

Deploy ops-dashboard #21

Deploy ops-dashboard

Deploy ops-dashboard #21

name: Deploy ops-dashboard
on:
workflow_dispatch:
inputs:
environment:
description: "Choose environment"
type: environment
required: true
action:
description: "Choose action"
type: choice
required: true
default: diff
options:
- diff
- deploy
jobs:
deploy-ops-dashboard:
name: "Deploy ops-dashboard"
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}
steps:
- name: Validate environment
uses: actions/github-script@v8
with:
script: |
if (!"${{ github.event.inputs.environment }}".startsWith("ops-dashboard")) {
throw new Error("Environment must start with 'ops-dashboard'");
}
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Dump secrets to /tmp/secrets.yaml
run: |
cat << 'EOF' | tee -a /tmp/secrets.yaml
${{ toJSON(secrets) }}
EOF
jq '.' /tmp/secrets.yaml
- name: Dump variables to /tmp/env.yaml
run: |
cat << 'EOF' | tee -a /tmp/env.yaml
${{ toJSON(vars) }}
EOF
jq '.' /tmp/env.yaml
- name: Merge secrets and variables
run: |
jq -s '.[0] + .[1]' /tmp/secrets.yaml /tmp/env.yaml > env.yaml
jq '.' env.yaml
working-directory: .ops/ops-dashboard
- name: Setup helm
run: |
mkdir ~/.kube && echo '${{ secrets.KUBECONFIG }}' > ~/.kube/config && chmod go-r ~/.kube/config
- uses: ./.github/actions/setup-helmfile
- name: Diff deployment
run: |
./deploy.sh diff || true
working-directory: .ops/ops-dashboard
- name: Show values.yaml
run: cat values.yaml
working-directory: .ops/ops-dashboard
- name: Deploy
if: ${{ github.event.inputs.action == 'deploy' }}
run: |
./deploy.sh deploy
working-directory: .ops/ops-dashboard