-
-
Notifications
You must be signed in to change notification settings - Fork 55
121 lines (109 loc) · 3.86 KB
/
build_and_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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Build and Push
on:
push:
branches:
- master
tags:
- "v*.*.*"
jobs:
build_and_push:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare
id: prepare
run: |
VERSION="latest"
TAG=""
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
TAG=${VERSION}
echo ::set-output name=tag::${TAG}
git submodule update --init --recursive --depth 1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to dockerhub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
# Application
- name: Docker Test Application
id: docker_test_application
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-app
file: ./docker-app/Dockerfile
- name: Docker Build and Push Application
id: docker_build_and_push_application
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
target: webserver_runtime
context: ./docker-app
file: ./docker-app/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: opengisch/qfieldcloud-app:${{ steps.prepare.outputs.tag }}
- name: Docker Build and Push Worker
id: docker_build_and_push_worker
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
target: worker_wrapper_runtime
context: ./docker-app
file: ./docker-app/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: opengisch/qfieldcloud-worker-wrapper:${{ steps.prepare.outputs.tag }}
# Redis
- name: Docker Test Redis
id: docker_test_redis
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-redis
file: ./docker-redis/Dockerfile
- name: Docker Build and Push Redis
id: docker_build_and_push_redis
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-redis
file: ./docker-redis/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: opengisch/qfieldcloud-redis:${{ steps.prepare.outputs.tag }}
# QGIS
- name: Docker Test QGIS
id: docker_test_qgis
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-qgis
file: ./docker-qgis/Dockerfile
- name: Docker Build and Push QGIS
id: docker_build_and_push_qgis
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-qgis
file: ./docker-qgis/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: opengisch/qfieldcloud-qgis:${{ steps.prepare.outputs.tag }}
- name: Trigger deployment on private repository
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GIT_ACCESS_TOKEN }}
repository: opengisch/qfieldcloud-private
event-type: public_dispatch
client-payload: '{"version": "${{ steps.prepare.outputs.tag }}"}'