-
Notifications
You must be signed in to change notification settings - Fork 24
119 lines (99 loc) · 3.04 KB
/
build-test-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
name: build-test-push
on:
push:
branches:
- master
defaults:
run:
# explicitly setting `bash` enables safe settings (errexit, pipefail, ...)
shell: bash
jobs:
build-test-push:
runs-on: ubuntu-20.04
outputs:
tag: ${{ steps.prep.outputs.tag }}
strategy:
fail-fast: false
matrix:
config: [base, temple, factionhall, tstvhq, gojo-video]
include:
- config: base
theme: basic
- config: temple
theme: temple
- config: factionhall
theme: factionhall
- config: tstvhq
theme: tst
- config: gojo-video
theme: basic
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout repo
uses: actions/checkout@v2
- name: Detect changed files
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
app:
- 'app/**'
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true # Aliases docker build command to docker buildx
- 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: Prep tags
id: prep
run: |
IMAGE=cabinweekend/jitsi-party-web
TAG_SHA=${{ matrix.config }}-${{ matrix.theme }}-$(echo $GITHUB_SHA)
TAG_LATEST=${{ matrix.config }}-${{ matrix.theme }}-latest
echo ::set-output name=tagged_image_sha::${IMAGE}:${TAG_SHA}
echo ::set-output name=tagged_image_latest::${IMAGE}:${TAG_LATEST}
- name: Set config and theme
run: |
app/set_config.sh ${{ matrix.config }}
app/set_theme.sh ${{ matrix.theme }}
- name: Install protoc
uses: arduino/setup-protoc@v1
with:
version: '3.x'
- name: Build config and client
run: |
make env
docker-compose pull node
make webpack
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and tag app image
if: ${{ steps.changes.outputs.app }} == 'true'
uses: docker/build-push-action@v2
with:
context: ./app
builder: ${{ steps.buildx.outputs.name }}
file: ./app/Dockerfile
push: true
tags: ${{ steps.prep.outputs.tagged_image_sha }},${{ steps.prep.outputs.tagged_image_latest }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache