forked from sillsdev/web-languageforge
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (72 loc) · 2.38 KB
/
integrate-and-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
name: Integrate changes and deploy
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
on:
workflow_call:
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_callinputs
inputs:
image-tag:
type: string
required: true
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_callsecrets
secrets:
kube-context:
required: true
image-repo-username:
required: true
image-repo-password:
required: true
jobs:
integrate:
runs-on: ubuntu-latest
env:
# https://docs.docker.com/develop/develop-images/build_enhancements/
DOCKER_BUILDKIT: 1
defaults:
run:
working-directory: docker
steps:
-
uses: actions/checkout@v2
-
run: |
docker --version
docker-compose --version
-
name: Establish image name
id: image
run: |
echo ::set-output name=NAMESPACE::sillsdev/web-languageforge
echo ::set-output name=TAG::${{ inputs.image-tag }}
-
name: Build app
run: docker-compose build --build-arg ENVIRONMENT=production --build-arg BUILD_VERSION=${{ steps.image.outputs.TAG }} app
-
run: docker-compose run --rm app cat /var/www/html/build-version.txt /var/www/html/version.php
-
name: Check unit tests
run: make unit-tests-ci
# -
# name: Check e2e tests
# run: make e2e-tests-ci
-
name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.image-repo-username }}
password: ${{ secrets.image-repo-password }}
-
name: Tag image
run: docker tag lf-app ${{ steps.image.outputs.NAMESPACE }}:${{ steps.image.outputs.TAG }}
-
name: Publish image
run: docker push ${{ steps.image.outputs.NAMESPACE }}:${{ steps.image.outputs.TAG }}
outputs:
IMAGE: ${{ steps.image.outputs.NAMESPACE }}:${{ steps.image.outputs.TAG }}
deploy:
runs-on: [self-hosted, languageforge]
needs: integrate
steps:
-
uses: sillsdev/common-github-actions/install-kubectl@v1
-
run: kubectl --context ${{ secrets.kube-context }} set image deployment/app app=${{ needs.integrate.outputs.IMAGE }}