feat: Add GitHub Actions CI pipeline

Signed-off-by: Christoph Heiss <contact@christoph-heiss.at>
This commit is contained in:
Christoph Heiss 2022-06-22 13:55:04 +02:00
parent 4011a8124a
commit 76d160ba59
Signed by: c8h4
GPG key ID: 9C82009BEEDEA0FF
2 changed files with 63 additions and 0 deletions

63
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,63 @@
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 }}

0
public/.gitkeep Normal file
View file