You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.0 KiB

name: Deploy to Github Pages / Docker hub
on:
push:
branches:
- master
paths:
- src/**
- public/**
- Dockerfile
- package.json
- tsconfig.json
- next.config.js
- .github/workflows/**
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 website
run: yarn run export
env:
NODE_ENV: production
- uses: actions/upload-artifact@v3
with:
name: output
path: out
pages:
runs-on: ubuntu-latest
needs: test
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: Build website
run: yarn run export
env:
NODE_ENV: production
- name: Deploy to pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./out
cname: materialtube.guusvanmeerveld.dev
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