feat: Add GitHub Actions CI pipeline
Signed-off-by: Christoph Heiss <contact@christoph-heiss.at>
This commit is contained in:
parent
4011a8124a
commit
76d160ba59
63
.github/workflows/build.yml
vendored
Normal file
63
.github/workflows/build.yml
vendored
Normal 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
0
public/.gitkeep
Normal file
Reference in a new issue