64 lines
1.6 KiB
YAML
64 lines
1.6 KiB
YAML
name: Lint and build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 17
|
|
- run: npm clean-install
|
|
- run: npm run lint:types
|
|
- run: npm run lint:tsx
|
|
- run: npm run lint:scss
|
|
|
|
build:
|
|
needs: lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 17
|
|
- run: npm clean-install
|
|
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: ${{ github.workspace }}/.next/cache
|
|
# Generate a new cache whenever packages or source files change.
|
|
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
|
|
# If source files changed but packages didn't, rebuild from a prior cache.
|
|
restore-keys: |
|
|
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
|
|
|
|
- run: npm run build
|
|
|
|
docker-image:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: docker/setup-buildx-action@v2
|
|
|
|
- uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
tags: |
|
|
ghcr.io/christoph-heiss/wgdash:latest
|
|
push: ${{ github.ref == 'refs/heads/main' }}
|
|
build-args: |
|
|
GIT_COMMIT_SHA=${{ github.sha }}
|