-
Notifications
You must be signed in to change notification settings - Fork 210
170 lines (160 loc) · 5.25 KB
/
build.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: docker-buildx
on:
pull_request:
branches:
- master
- experimental
push:
branches:
- '**'
tags:
- '*.*'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
services:
mariadb:
image: mariadb:lts
ports:
- 3306
env:
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_DATABASE: pigallery_test
MYSQL_ROOT_PASSWORD: password
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Verify MariaDB connection
env:
PORT: ${{ job.services.mariadb.ports[3306] }}
run: |
while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do
sleep 1
done
- name: npm install and build
run: |
npm ci
npm run build
- name: lint
run: |
npm run lint
- name: test
run: |
npm test
env:
MYSQL_HOST: localhost
MYSQL_USERNAME: root
MYSQL_PASSWORD: password
MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }}
PORT: 35000
CI: true
create-release:
runs-on: [ubuntu-latest]
needs: [test]
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Setup Node.js for use with actions
uses: actions/setup-node@v3
with:
node-version: 18
-
name: Install Deps
run: npm install --unsafe-perm
-
name: Create Release
run: npm run create-release -- --skip-opt-packages=ffmpeg-static,ffprobe-static --force-opt-packages
- uses: actions/upload-artifact@v3
with:
name: pigallery2-release
path: release
build-dockerx:
runs-on: [ ubuntu-latest ]
needs: [ create-release ]
strategy:
matrix:
container: [alpine, debian-buster, debian-bullseye ]
include:
- container: alpine
platforms: linux/amd64,linux/arm64,linux/arm/v7
- container: debian-buster
platforms: linux/amd64,linux/arm64,linux/arm/v7
- container: debian-bullseye
platforms: linux/amd64,linux/arm64,linux/arm/v7
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: pigallery2-release
path: pigallery2-release
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build docker
uses: docker/build-push-action@v3
with:
context: .
file: docker/${{ matrix.container }}/Dockerfile.build
platforms: ${{ matrix.platforms }}
- name: Push experimental
if: ${{ github.ref == 'refs/heads/experimental' }}
uses: docker/build-push-action@v3
with:
context: .
file: docker/${{ matrix.container }}/Dockerfile.build
platforms: ${{ matrix.platforms }}
push: true
tags: bpatrik/pigallery2:experimental-${{ matrix.container }}
- name: Push nightly on new master commit
# github.ref: branches the format is refs/heads/<branch_name> PRs and Tags are different
if: ${{github.ref == 'refs/heads/master' }}
uses: docker/build-push-action@v3
with:
context: .
file: docker/${{ matrix.container }}/Dockerfile.build
platforms: ${{ matrix.platforms }}
push: true
tags: bpatrik/pigallery2:nightly-${{ matrix.container }}
- name: Push release on new Tag
if: ${{ startsWith(github.ref_type , 'tag') && !github.event.issue.pull_request && matrix.container != 'debian-bullseye'}}
uses: docker/build-push-action@v3
with:
context: .
file: docker/${{ matrix.container }}/Dockerfile.build
platforms: ${{ matrix.platforms }}
push: true
tags: |
bpatrik/pigallery2:nightly-${{ matrix.container }}
bpatrik/pigallery2:${{ github.ref_name }}-${{ matrix.container }}
bpatrik/pigallery2:latest-${{ matrix.container }}
- name: Push latest on new Tag
if: ${{ startsWith(github.ref_type, 'tag') && !github.event.issue.pull_request && matrix.container == 'debian-bullseye'}}
uses: docker/build-push-action@v3
with:
context: .
file: docker/${{ matrix.container }}/Dockerfile.build
platforms: ${{ matrix.platforms }}
push: true
tags: |
bpatrik/pigallery2:nightly-${{ matrix.container }}
bpatrik/pigallery2:${{ github.ref_name }}-${{ matrix.container }}
bpatrik/pigallery2:latest-${{ matrix.container }}
bpatrik/pigallery2:${{ github.ref_name }}
bpatrik/pigallery2:latest