-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (54 loc) · 1.99 KB
/
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
name: Deploy
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
config:
- churches
- paintings
- modemuze-materialen
- modemuze-periodes
- zuiderzeemuseum-locaties
environment:
name: heritageflix-${{ matrix.config }}
url: https://heritageflix-${{ matrix.config }}.demo.netwerkdigitaalerfgoed.nl
steps:
- uses: actions/checkout@v4
- name: Set variables
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "docker_image=ghcr.io/netwerk-digitaal-erfgoed/heritageflix-${{ matrix.config }}" >> $GITHUB_OUTPUT
echo "deployment=heritageflix-${{ matrix.config }}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
- name: Build and push image to registry
uses: docker/build-push-action@v5
with:
push: true
build-args: CONFIG=${{ matrix.config }}
tags: |
${{ steps.vars.outputs.docker_image }}:${{ steps.vars.outputs.sha_short }}
${{ steps.vars.outputs.docker_image }}:latest
- uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Store DigitalOcean credentials
run: doctl kubernetes cluster kubeconfig save nde
- name: Update deployment
run: |
kubectl set image deployment/${{ steps.vars.outputs.deployment }} app=${{ steps.vars.outputs.docker_image }}:${{ steps.vars.outputs.sha_short }}
- name: Verify deployment
run: kubectl rollout status deployment/${{ steps.vars.outputs.deployment }} --timeout=120s