1
+ name : Continuous Deployment
2
+ on :
3
+ push :
4
+ tags :
5
+ - v*
6
+ branches :
7
+ - main
8
+ - develop
9
+
10
+ jobs :
11
+ lint :
12
+ runs-on : ubuntu-latest
13
+ steps :
14
+ - uses : actions/checkout@master
15
+ - name : Setup Go ${{ matrix.go-version }}
16
+ uses : actions/setup-go@v5
17
+ with :
18
+ go-version : 1.23
19
+ - name : install schemalint
20
+ run : go install github.com/giantswarm/schemalint/v2@latest
21
+ - name : lint schema files
22
+ run : |
23
+ for i in ./schemas/*.json;
24
+ do echo "checking $i";
25
+ schemalint verify $i;
26
+ done
27
+
28
+ containerize :
29
+ runs-on : ubuntu-latest
30
+ needs : lint
31
+ if : ${{ github.ref_type == 'tag' }}
32
+ strategy :
33
+ matrix :
34
+ BUILD_HOST : ["http://localhost/", "https://json.libremfg.ai/"]
35
+ permissions :
36
+ contents : read
37
+ packages : write
38
+ steps :
39
+ - uses : actions/checkout@master
40
+ - name : Login to GitHub Container Registry
41
+ uses : docker/login-action@v3
42
+ with :
43
+ registry : ghcr.io
44
+ username : ${{ github.actor }}
45
+ password : ${{ secrets.GITHUB_TOKEN }}
46
+ - name : Publish to GitHub Container Registry for localhost
47
+ if : ${{ github.ref_type == 'tag' && matrix.BUILD_HOST == 'http://localhost/' }}
48
+ uses : docker/build-push-action@v6
49
+ with :
50
+ push : true
51
+ file : ./docker/Dockerfile
52
+ build-args : |
53
+ HOST=${{ matrix.BUILD_HOST }}
54
+ tags : |
55
+ ghcr.io/libremfg/json-schema:${{ github.ref_name }}
56
+ ghcr.io/libremfg/json-schema:latest
57
+ - name : Publish to GitHub Container Registry for json.libremfg.ai
58
+ if : ${{ github.ref_type == 'tag' && matrix.BUILD_HOST == 'https://json.libremfg.ai/' }}
59
+ uses : docker/build-push-action@v6
60
+ with :
61
+ push : true
62
+ file : ./docker/Dockerfile
63
+ build-args : |
64
+ HOST=${{ matrix.BUILD_HOST }}
65
+ tags : |
66
+ ghcr.io/libremfg/json-schema:jsonlibremfgai-${{ github.ref_name }}
67
+ ghcr.io/libremfg/json-schema:jsonlibremfgai-latest
68
+
69
+ deploy :
70
+ runs-on : ubuntu-latest
71
+ needs : containerize
72
+ if : ${{ github.ref_type == 'tag' }}
73
+ env :
74
+ ENV_SLUG : jsonlibremfgai
75
+ KUBE_NAMESPACE : json-schema
76
+ INGRESS_HOST : json.libremfg.ai
77
+ steps :
78
+ - name : Set the Kubernetes context
79
+ uses : azure/k8s-set-context@v2
80
+ with :
81
+ method : service-account
82
+ k8s-url : ${{ secrets.NA1_KUBERNETES_URL }}
83
+ k8s-secret : ${{ secrets.NA1_KUBERNETES_SECRET }}
84
+ - name : Install Helm
85
+
86
+ - uses : actions/checkout@master
87
+ - name : Helm Install
88
+ run : |
89
+ if [ -z "$CI_COMMIT_TAG" ]; then
90
+ export TAG=$ENV_SLUG-latest;
91
+ else
92
+ export TAG=$ENV_SLUG-$CI_COMMIT_TAG;
93
+ fi
94
+ echo "using tag $TAG";
95
+ helm upgrade --install libremfg-jsonschema ./chart \
96
+ --set image.tag=$TAG \
97
+ --set ingress.enabled=true \
98
+ --set ingress.className=traefik \
99
+ --set ingress.hosts[0].host=$INGRESS_HOST \
100
+ --set ingress.hosts[0].paths[0].path=/ \
101
+ --set ingress.hosts[0].paths[0].pathType=ImplementationSpecific \
102
+ --set ingress.tls[0].hosts[0]=$INGRESS_HOST \
103
+ --set ingress.tls[0].secretName=$INGRESS_HOST-tls \
104
+ --namespace $KUBE_NAMESPACE
0 commit comments