-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (79 loc) · 2.44 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Continuous integration
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Define container metadata before build
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/inje-megabrain/megabrain.kr
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Setup nodejs
uses: actions/setup-node@v2
with:
node-version: 20
cache: npm
- name: Install npm dependencies
run: npm ci
- name: Build
run: npm run build
- name: Set up Docker Buildx (Builder instance)
uses: docker/setup-buildx-action@v2
- name: Login to Github Container Registry for Image Push
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build Image and Push
uses: docker/build-push-action@v2
with:
context: .
push: true
platform: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
kubernetes-resource-update:
name: Kubernetes resource update
runs-on: ubuntu-latest
needs: build
steps:
- name: Setup Kustomize
uses: imranismail/setup-kustomize@v1
- name: Checkout kustomize repo
uses: actions/checkout@v2
with:
repository: inje-megabrain/megabrain-infra-apps
ref: apps/megabrain-site
token: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Update Kubernetes resource
run: |
cd apps/megabrain-site/overlays/dev
kustomize edit set image ghcr.io/inje-megabrain/megabrain.kr:main
cat kustomization.yaml
- name: Commit and push changes
run: |
cd apps/megabrain-site
git config --global user.name puleugo
git config --global user.email [email protected]
git commit -am "Update k8s image"
git push -u origin apps/megabrain-site