2019-12-24 04:00:08 +08:00
|
|
|
name: docker-buildx
|
2019-12-21 02:12:34 +08:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches: master
|
|
|
|
push:
|
|
|
|
branches: master
|
2019-12-30 07:43:52 +08:00
|
|
|
tags:
|
2019-12-30 07:50:47 +08:00
|
|
|
- '*.*'
|
2019-12-21 02:12:34 +08:00
|
|
|
|
|
|
|
jobs:
|
2020-01-09 05:44:47 +08:00
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
2020-09-06 20:58:02 +08:00
|
|
|
|
2020-01-09 05:44:47 +08:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-12-26 19:11:31 +08:00
|
|
|
node-version: [12.x, 13.x, 14.x]
|
2020-09-06 20:58:02 +08:00
|
|
|
|
2020-01-29 20:15:02 +08:00
|
|
|
services:
|
|
|
|
mariadb:
|
|
|
|
image: mariadb:latest
|
|
|
|
ports:
|
2020-01-29 23:15:39 +08:00
|
|
|
- 3306
|
2020-01-29 20:15:02 +08:00
|
|
|
env:
|
|
|
|
MYSQL_USER: user
|
|
|
|
MYSQL_PASSWORD: password
|
2020-01-30 06:02:07 +08:00
|
|
|
MYSQL_DATABASE: pigallery_test
|
2020-01-29 20:15:02 +08:00
|
|
|
MYSQL_ROOT_PASSWORD: password
|
|
|
|
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
|
|
|
|
|
2020-01-09 05:44:47 +08:00
|
|
|
|
|
|
|
steps:
|
2020-12-25 17:54:28 +08:00
|
|
|
- uses: actions/checkout@v2
|
2020-01-09 05:44:47 +08:00
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
2020-12-25 17:54:28 +08:00
|
|
|
uses: actions/setup-node@v2
|
2020-01-09 05:44:47 +08:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
2020-09-06 20:58:02 +08:00
|
|
|
|
2020-01-29 20:15:02 +08:00
|
|
|
- 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
|
2020-09-06 20:58:02 +08:00
|
|
|
done
|
|
|
|
|
2020-01-09 05:44:47 +08:00
|
|
|
- name: npm install, build, and test
|
|
|
|
run: |
|
|
|
|
npm ci
|
|
|
|
npm run build --if-present
|
|
|
|
npm test
|
|
|
|
env:
|
2020-01-29 20:15:02 +08:00
|
|
|
MYSQL_HOST: localhost
|
2020-01-30 06:14:46 +08:00
|
|
|
MYSQL_USERNAME: root
|
2020-01-29 20:15:02 +08:00
|
|
|
MYSQL_PASSWORD: password
|
2020-01-29 23:15:39 +08:00
|
|
|
MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }}
|
2020-01-29 19:29:25 +08:00
|
|
|
PORT: 35000
|
2020-01-09 05:44:47 +08:00
|
|
|
CI: true
|
2020-09-06 20:58:02 +08:00
|
|
|
|
2019-12-21 02:12:34 +08:00
|
|
|
create-release:
|
|
|
|
runs-on: [ubuntu-latest]
|
2020-01-09 05:44:47 +08:00
|
|
|
needs: [test]
|
2019-12-21 02:12:34 +08:00
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2020-12-25 17:54:28 +08:00
|
|
|
uses: actions/checkout@v2
|
2019-12-21 03:44:15 +08:00
|
|
|
-
|
2019-12-21 02:12:34 +08:00
|
|
|
name: Setup Node.js for use with actions
|
2020-12-25 17:54:28 +08:00
|
|
|
uses: actions/setup-node@v2
|
2019-12-21 02:12:34 +08:00
|
|
|
with:
|
2020-12-26 02:54:43 +08:00
|
|
|
node-version: 12
|
2019-12-21 03:44:15 +08:00
|
|
|
-
|
2019-12-21 02:12:34 +08:00
|
|
|
name: Install Deps
|
|
|
|
run: npm install --unsafe-perm
|
|
|
|
-
|
|
|
|
name: Create Release
|
2019-12-22 07:04:52 +08:00
|
|
|
run: npm run create-release -- --skip-opt-packages=ffmpeg,ffprobe --force-opt-packages
|
2020-12-25 17:54:28 +08:00
|
|
|
- uses: actions/upload-artifact@v2
|
2019-12-21 02:12:34 +08:00
|
|
|
with:
|
|
|
|
name: pigallery2-release
|
|
|
|
path: release
|
2020-01-01 21:15:15 +08:00
|
|
|
build-alpine:
|
|
|
|
runs-on: [ubuntu-latest]
|
|
|
|
needs: [create-release]
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Set tag
|
|
|
|
id: vars
|
|
|
|
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10}) && echo ::set-output name=type::$(echo ${GITHUB_REF:5})
|
|
|
|
-
|
|
|
|
name: Checkout
|
2020-12-25 17:54:28 +08:00
|
|
|
uses: actions/checkout@v2
|
2020-01-01 21:15:15 +08:00
|
|
|
-
|
2020-12-25 17:54:28 +08:00
|
|
|
uses: actions/download-artifact@v2
|
2020-01-01 21:15:15 +08:00
|
|
|
with:
|
2020-12-26 19:11:31 +08:00
|
|
|
name: pigallery2-release
|
|
|
|
path: pigallery2-release
|
2020-12-25 22:31:59 +08:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
2020-01-01 21:15:15 +08:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2020-12-25 17:54:28 +08:00
|
|
|
uses: docker/setup-buildx-action@v1
|
2020-01-01 21:15:15 +08:00
|
|
|
-
|
2020-12-25 22:31:59 +08:00
|
|
|
name: Login to DockerHub
|
2020-12-26 19:11:31 +08:00
|
|
|
uses: docker/login-action@v1
|
2020-12-25 22:31:59 +08:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
2020-12-26 19:11:31 +08:00
|
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
2020-01-01 21:15:15 +08:00
|
|
|
-
|
2020-12-25 22:31:59 +08:00
|
|
|
name: Build and push alpine nightly
|
2020-01-01 21:15:15 +08:00
|
|
|
if: startsWith(steps.vars.outputs.type , 'head')
|
2020-12-25 22:31:59 +08:00
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: docker/alpine/Dockerfile.build
|
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
|
|
push: true
|
2020-12-26 19:11:31 +08:00
|
|
|
tags: bpatrik/pigallery2:nightly-alpine
|
2020-12-25 22:31:59 +08:00
|
|
|
-
|
2020-12-26 01:59:01 +08:00
|
|
|
name: Build and push alpine release
|
2020-01-01 21:15:15 +08:00
|
|
|
if: startsWith(steps.vars.outputs.type , 'tag')
|
|
|
|
env:
|
|
|
|
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
|
2020-12-25 22:31:59 +08:00
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: docker/alpine/Dockerfile.build
|
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
|
|
push: true
|
|
|
|
tags: |
|
|
|
|
bpatrik/pigallery2:nightly-alpine
|
|
|
|
bpatrik/pigallery2:$RELEASE_VERSION-alpine
|
|
|
|
bpatrik/pigallery2:latest-alpine
|
2019-12-23 21:55:42 +08:00
|
|
|
build-stretch:
|
|
|
|
runs-on: [ubuntu-latest]
|
|
|
|
needs: [create-release]
|
|
|
|
steps:
|
2019-12-30 07:43:52 +08:00
|
|
|
-
|
|
|
|
name: Set tag
|
|
|
|
id: vars
|
2019-12-30 07:50:03 +08:00
|
|
|
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10}) && echo ::set-output name=type::$(echo ${GITHUB_REF:5})
|
2019-12-23 21:55:42 +08:00
|
|
|
-
|
|
|
|
name: Checkout
|
2020-12-25 17:54:28 +08:00
|
|
|
uses: actions/checkout@v2
|
2019-12-23 21:55:42 +08:00
|
|
|
-
|
2020-12-25 17:54:28 +08:00
|
|
|
uses: actions/download-artifact@v2
|
2019-12-23 21:55:42 +08:00
|
|
|
with:
|
2020-12-26 19:11:31 +08:00
|
|
|
name: pigallery2-release
|
|
|
|
path: pigallery2-release
|
2020-12-26 01:59:01 +08:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
2019-12-23 21:55:42 +08:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2020-12-25 17:54:28 +08:00
|
|
|
uses: docker/setup-buildx-action@v1
|
2019-12-23 21:55:42 +08:00
|
|
|
-
|
2020-12-26 01:59:01 +08:00
|
|
|
name: Login to DockerHub
|
2020-12-26 19:11:31 +08:00
|
|
|
uses: docker/login-action@v1
|
2020-12-26 01:59:01 +08:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
2020-12-26 19:11:31 +08:00
|
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
2019-12-23 21:55:42 +08:00
|
|
|
-
|
2020-12-26 19:11:31 +08:00
|
|
|
name: Build and push debian stretch nightly
|
2019-12-30 07:50:03 +08:00
|
|
|
if: startsWith(steps.vars.outputs.type , 'head')
|
2020-12-26 01:59:01 +08:00
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: docker/debian-stretch/Dockerfile.build
|
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
|
|
push: true
|
2020-12-26 19:11:31 +08:00
|
|
|
tags: bpatrik/pigallery2:nightly-stretch
|
2020-12-26 01:59:01 +08:00
|
|
|
-
|
|
|
|
name: Build and push debian stretch release
|
2019-12-30 07:50:03 +08:00
|
|
|
if: startsWith(steps.vars.outputs.type , 'tag')
|
2019-12-30 07:43:52 +08:00
|
|
|
env:
|
|
|
|
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
|
2020-12-26 01:59:01 +08:00
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: docker/debian-stretch/Dockerfile.build
|
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
|
|
push: true
|
|
|
|
tags: |
|
|
|
|
bpatrik/pigallery2:nightly-stretch
|
2020-12-26 19:11:31 +08:00
|
|
|
bpatrik/pigallery2:$RELEASE_VERSION-stretch
|
|
|
|
bpatrik/pigallery2:latest-stretch
|
|
|
|
build-buster:
|
|
|
|
runs-on: [ubuntu-latest]
|
|
|
|
needs: [create-release]
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Set tag
|
|
|
|
id: vars
|
|
|
|
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10}) && echo ::set-output name=type::$(echo ${GITHUB_REF:5})
|
|
|
|
-
|
|
|
|
name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
-
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: pigallery2-release
|
|
|
|
path: pigallery2-release
|
|
|
|
-
|
|
|
|
name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
-
|
|
|
|
name: Login to DockerHub
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
-
|
|
|
|
name: Build and push debian buster nightly
|
|
|
|
if: startsWith(steps.vars.outputs.type , 'head')
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: docker/debian-stretch/Dockerfile.build
|
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
|
|
push: true
|
|
|
|
tags: bpatrik/pigallery2:nightly-buster
|
|
|
|
-
|
|
|
|
name: Build and push debian buster release
|
|
|
|
if: startsWith(steps.vars.outputs.type , 'tag')
|
|
|
|
env:
|
|
|
|
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: docker/debian-buster/Dockerfile.build
|
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
|
|
push: true
|
|
|
|
tags: |
|
|
|
|
bpatrik/pigallery2:nightly-buster
|
2020-12-26 01:59:01 +08:00
|
|
|
bpatrik/pigallery2:$RELEASE_VERSION
|
|
|
|
bpatrik/pigallery2:latest
|