-
Notifications
You must be signed in to change notification settings - Fork 3
90 lines (76 loc) · 2.6 KB
/
production-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
88
89
90
name: production-deploy
on:
push:
branches:
- master
- beatmaps-schema-cleanup
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/akatsuki-api
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/akatsuki-api:latest
${{ secrets.DOCKERHUB_USERNAME }}/akatsuki-api:${{ 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
chmod 600 $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_2024 }}
path: common-helm-charts
- name: Clear pending deployments
run: |
kubectl delete secret -l 'status in (pending-install, pending-upgrade, pending-rollback),name=akatsuki-api-production'
- name: Show manifest diff since previous release
run: |
helm diff upgrade \
--allow-unreleased \
--color=true \
--values chart/values.yaml \
akatsuki-api-production \
common-helm-charts/microservice-base/
- name: Deploy service to production cluster
run: |
helm upgrade \
--install \
--atomic \
--wait --timeout 10m \
--cleanup-on-fail \
--values chart/values.yaml \
akatsuki-api-production \
common-helm-charts/microservice-base/