4
4
workflow_dispatch :
5
5
inputs :
6
6
environment :
7
- description : ' Choose environment'
7
+ description : " Choose environment"
8
8
type : environment
9
9
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
11
18
12
19
jobs :
13
20
deploy-ops-dashboard :
@@ -26,40 +33,43 @@ jobs:
26
33
27
34
- uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
28
35
29
- - name : Dump secrets to .env
36
+ - name : Dump secrets to /tmp/secrets.yaml
30
37
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
33
42
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
38
49
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
41
54
working-directory : .ops/ops-dashboard
42
55
43
56
- name : Setup helm
44
57
run : |
45
58
mkdir ~/.kube && echo '${{ secrets.KUBECONFIG }}' > ~/.kube/config && chmod go-r ~/.kube/config
46
59
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
52
61
53
62
- name : Diff deployment
54
63
run : |
55
64
./deploy.sh diff || true
56
65
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
60
69
working-directory : .ops/ops-dashboard
61
70
62
71
- name : Deploy
72
+ if : ${{ github.event.inputs.action == 'deploy' }}
63
73
run : |
64
74
./deploy.sh deploy
65
75
working-directory : .ops/ops-dashboard
0 commit comments