-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (33 loc) · 1.35 KB
/
main.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
on:
push:
branches:
- develop
jobs:
build:
name: Build, push, and deploy
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v2
- name: Update submodules
run: git submodule update --init --recursive
- name: Build container image
run: docker build --tag docker.pkg.github.com/hugomd/blog/blog:$(echo $GITHUB_SHA | head -c7) --tag hugomd/blog:latest .
- name: Docker login
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: docker login -u hugomd -p $GITHUB_TOKEN docker.pkg.github.com
- name: Push image to Docker Hub
run: docker push docker.pkg.github.com/hugomd/blog/blog
- name: Save DigitalOcean kubeconfig
uses: digitalocean/action-doctl@master
env:
DIGITALOCEAN_ACCESS_TOKEN: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
with:
args: kubernetes cluster kubeconfig show madrisa-sgp-01 > $GITHUB_WORKSPACE/.kubeconfig
- name: Update SHA
run: sed -i "s/<VERSION>/$(echo $GITHUB_SHA | head -c7)/g" deployment.yaml
- name: Deploy to DigitalOcean Kubernetes
run: kubectl --kubeconfig=$GITHUB_WORKSPACE/.kubeconfig apply -f $GITHUB_WORKSPACE/deployment.yaml
- name: Verify deployment
run: kubectl --kubeconfig=$GITHUB_WORKSPACE/.kubeconfig -n blog rollout status deployment/blog