-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (73 loc) · 2.5 KB
/
k8s-deploy.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
name: k8s-deploy
on:
push:
branches:
- main
- k8s-deploy
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
production-deploy:
runs-on: ubuntu-latest
steps:
- name: Check out latest commit
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: osuAkatsuki/rework-frontend
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/rework-frontend:latest
${{ secrets.DOCKERHUB_USERNAME }}/rework-frontend:${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}
- name: Get kubeconfig from github secrets
run: |
mkdir -p $HOME/.kube
echo "${{ secrets.KUBECONFIG }}" > $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
- name: Install helm
uses: azure/setup-helm@v3
with:
version: "latest"
token: ${{ secrets.GITHUB_TOKEN }}
id: install
- name: Install helm-diff
run: helm plugin install https://github.com/databus23/helm-diff
- name: Checkout common-helm-charts repo
uses: actions/checkout@v3
with:
repository: osuAkatsuki/common-helm-charts
token: ${{ secrets.COMMON_HELM_CHARTS_PAT }}
path: common-helm-charts
- name: Clear pending deployments
run: |
kubectl get secret -lname=rework-frontend-production -lstatus=pending-upgrade -oname | xargs --no-run-if-empty kubectl delete
- name: Show manifest diff since previous release
run: |
helm diff upgrade \
--allow-unreleased \
--values chart/values.yaml \
rework-frontend-production \
common-helm-charts/microservice-base/
- name: Deploy service to production cluster
run: |
helm upgrade \
--install \
--atomic \
--wait --timeout 480s \
--values chart/values.yaml \
rework-frontend-production \
common-helm-charts/microservice-base/