-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (92 loc) · 2.71 KB
/
prod.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
93
94
95
96
name: CI for prod deployment
on:
push:
tags:
- 'v*'
jobs:
release_github:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Publish release
uses: release-drafter/release-drafter@v5
with:
name: ${{ steps.get_version.outputs.VERSION }}
tag: ${{ steps.get_version.outputs.VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-push:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.get_branch.outputs.branch }}
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: make CONTINUE=y build-prod
- name: Test running the docker containers
run: |
make CONTINUE=y up-prod
./infra/scripts/test-alive.sh localhost
make down-prod
- name: Login to GHCR
if: success()
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push on GHCR
if: success()
run: |
make push
make push-latest
- name: Delete untagged images
uses: vlaurin/action-ghcr-prune@main
with:
token: ${{ secrets.PERSO_ACCESS_TOKEN }}
organization: datalab-mi
container: basegun/basegun-backend
dry-run: false
untagged: true
- name: Delete untagged images
uses: vlaurin/action-ghcr-prune@main
with:
token: ${{ secrets.PERSO_ACCESS_TOKEN }}
organization: datalab-mi
container: basegun/basegun-frontend
dry-run: false
untagged: true
- name: Get branch
id: get_branch
run: |
raw=$(git branch -r --contains ${{ github.ref }})
branch=${raw##*/}
echo "{name}=branch" >> $GITHUB_OUTPUT
echo "Branch is $branch."
deploy-prod:
uses: ./.github/workflows/change-values-kube.yml
needs: build-push
with:
branch: ${{ needs.check.outputs.branch }}
namespace: basegun-prod
domain: basegun.fr
secrets:
API_OVH_TOKEN: ${{ secrets.API_OVH_TOKEN }}
OS_PASSWORD: ${{ secrets.OS_PASSWORD }}
OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }}
OS_USERNAME: ${{ secrets.OS_USERNAME }}
X_OVH_TOKEN: ${{ secrets.PROD_OVH_TOKEN }}
JOB_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KUBECONFIG: ${{ secrets.PROD_K8_CONFIG }}
test:
runs-on: ubuntu-latest
needs: deploy-preprod
steps:
- uses: actions/checkout@v2
- name: Test DNS
if: success()
run : |
./infra/scripts/test-alive.sh preprod.basegun.fr