|
|
|
name: Deploy to Github Pages / Docker hub
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
paths:
|
|
|
|
- src/**
|
|
|
|
- public/**
|
|
|
|
- Dockerfile
|
|
|
|
- package.json
|
|
|
|
- tsconfig.json
|
|
|
|
- next.config.js
|
|
|
|
- .github/workflows/deploy.yml
|
|
|
|
|
|
|
|
env:
|
|
|
|
NEXT_TELEMETRY_DISABLED: 1
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Setup
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup Node.js
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: "16.x"
|
|
|
|
cache: "yarn"
|
|
|
|
|
|
|
|
- name: Install npm dependencies
|
|
|
|
run: yarn install
|
|
|
|
|
|
|
|
- name: Lint
|
|
|
|
run: yarn run lint
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: yarn run build
|
|
|
|
|
|
|
|
docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: test
|
|
|
|
steps:
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
# Login
|
|
|
|
- name: Login to DockerHub
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: guusvanmeerveld
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
|
|
# Build & Push
|
|
|
|
- name: Build Dockerfile and push
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
push: true
|
|
|
|
tags: guusvanmeerveld/materialtube:latest
|
|
|
|
|
|
|
|
# Cache
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|