44 workflow_dispatch :
55 inputs :
66 environment :
7- description : ' Choose environment'
7+ description : " Choose environment"
88 type : environment
99 required : true
10- default : " ops-dashboard-dev"
10+ action :
11+ description : " Choose action"
12+ type : choice
13+ required : true
14+ default : diff
15+ options :
16+ - diff
17+ - deploy
1118
1219jobs :
1320 deploy-ops-dashboard :
@@ -26,40 +33,43 @@ jobs:
2633
2734 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
2835
29- - name : Dump secrets to .env
36+ - name : Dump secrets to /tmp/secrets.yaml
3037 run : |
31- echo '${{ toJSON(secrets) }}' | jq -r 'keys[] as $k | select(.[$k] |contains("\n") | not) | "\($k)=\"\(.[$k])\""' >> .env
32- working-directory : .ops/ops-dashboard
38+ cat << 'EOF' | tee -a /tmp/secrets.yaml
39+ ${{ toJSON(secrets) }}
40+ EOF
41+ jq '.' /tmp/secrets.yaml
3342
34- - name : Dump variables to .env
35- run : |
36- echo '${{ toJSON(vars) }}' | jq -r 'keys[] as $k | select(.[$k] |contains("\n") | not) | "\($k)=\"\(.[$k])\""' >> .env
37- working-directory : .ops/ops-dashboard
43+ - name : Dump variables to /tmp/env.yaml
44+ run : |
45+ cat << 'EOF' | tee -a /tmp/env.yaml
46+ ${{ toJSON(vars) }}
47+ EOF
48+ jq '.' /tmp/env.yaml
3849
39- - name : Show .env for debugging
40- run : echo "$(cat .env | sort)"
50+ - name : Merge secrets and variables
51+ run : |
52+ jq -s '.[0] + .[1]' /tmp/secrets.yaml /tmp/env.yaml > env.yaml
53+ jq '.' env.yaml
4154 working-directory : .ops/ops-dashboard
4255
4356 - name : Setup helm
4457 run : |
4558 mkdir ~/.kube && echo '${{ secrets.KUBECONFIG }}' > ~/.kube/config && chmod go-r ~/.kube/config
4659
47- - name : Add helm repositories
48- run : |
49- helm repo add oauth2-proxy https://oauth2-proxy.github.io/manifests
50- helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
51- helm repo update
60+ - uses : ./.github/actions/setup-helmfile
5261
5362 - name : Diff deployment
5463 run : |
5564 ./deploy.sh diff || true
5665 working-directory : .ops/ops-dashboard
57-
58- - name : Show values.out. yaml
59- run : cat values.out. yaml
66+
67+ - name : Show values.yaml
68+ run : cat values.yaml
6069 working-directory : .ops/ops-dashboard
6170
6271 - name : Deploy
72+ if : ${{ github.event.inputs.action == 'deploy' }}
6373 run : |
6474 ./deploy.sh deploy
6575 working-directory : .ops/ops-dashboard
0 commit comments