-
Notifications
You must be signed in to change notification settings - Fork 5
55 lines (43 loc) · 1.89 KB
/
server_adr_push.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
# This is a basic workflow to help you get started with Actions
name: SERVER_ADR_PUSH
# Controls when the workflow will run
on:
push:
branches:
- main
paths:
- ".github/workflows/server_adr_push.yml"
- "server/**"
- "Dockerfile"
- "package.json"
- "config/server/**"
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# deployment
server_deployment:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout the Repo
uses: actions/checkout@v3
- name: Build Server Image
run: docker build --file ./Dockerfile --tag registry.digitalocean.com/s6containers/adr_server:$(echo $GITHUB_SHA | head -c7) .
- name: Instal doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Log in to DO Container Registry
run: doctl registry login --expiry-seconds 600
- name: Push image to DO Container Registry
run: docker push registry.digitalocean.com/s6containers/adr_server:$(echo $GITHUB_SHA | head -c7)
- name: Update Deployment File
run: TAG=$(echo $GITHUB_SHA | head -c7) && sed -i 's|<IMAGE>|registry.digitalocean.com/s6containers/adr_server:'${TAG}'|' $GITHUB_WORKSPACE/config/server/deployment.yml
- name: Save DO Kubeconfig with short-lived credentials
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 cav-kube
- name: Deploy to DO Cluster
run: kubectl apply -f $GITHUB_WORKSPACE/config/server/deployment.yml
- name: Verify Deployment
run: kubectl rollout status deployment/adr-server -n 7cav