diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f8df2d5 --- /dev/null +++ b/.github/workflows/build.yml @@ -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 }} diff --git a/public/.gitkeep b/public/.gitkeep new file mode 100644 index 0000000..e69de29