Skip to content

Commit de85a09

Browse files
committed
chore(ci): Create continuous integration and deployment piplines
* Run `next lint` on pull requests * Publish container images to ghcr.io
1 parent c93a904 commit de85a09

File tree

6 files changed

+88
-0
lines changed

6 files changed

+88
-0
lines changed

.github/workflows/release.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Release
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- 'v*.*.*'
10+
11+
jobs:
12+
release-next-container:
13+
uses: radiorabe/actions/.github/workflows/[email protected]
14+
with:
15+
image: 'ghcr.io/radiorabe/website-stack/next'
16+
name: 'next'
17+
display-name: 'RaBe Nextjs Website'
18+
tags: 'rabe web nextjs alpine'
19+
# the alpine base image used for the nextjs frontend does not have a
20+
# keyless cosign signature, so we disable verifying the image.
21+
cosign-verify: false
22+
context: './next/'
23+
dockerfile: './next/Dockerfile.prod'
24+
build-args: |
25+
IMAGES_HOSTNAME=*.rabe.ch

.github/workflows/schedule.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Scheduled tasks
2+
3+
on:
4+
schedule:
5+
- cron: '13 12 * * *'
6+
workflow_dispatch:
7+
8+
jobs:
9+
schedule-trivy:
10+
uses: radiorabe/actions/.github/workflows/[email protected]
11+
with:
12+
image-ref: 'ghcr.io/radiorabe/website-stack/next:latest'

.github/workflows/test.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
6+
env:
7+
IMAGES_HOSTNAME: "*"
8+
9+
jobs:
10+
next-lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup node
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: 22
20+
cache: yarn
21+
cache-dependency-path: next/yarn.lock
22+
23+
- name: Install eslint (for easier rebasing, could be added to packages.json later)
24+
working-directory: ./next
25+
run: yarn add --dev eslint-config-next 'eslint@^8'
26+
27+
- name: Install dependencies
28+
working-directory: ./next
29+
run: yarn install --frozen-lockfile
30+
31+
- name: Running linter
32+
working-directory: ./next
33+
run: yarn run next lint --output-file ../next-eslint_report.json --format json
34+
continue-on-error: true
35+
36+
- name: Annotate Code Linting Results
37+
uses: ataylorme/eslint-annotate-action@v3
38+
with:
39+
report-json: "next-eslint_report.json"
40+
only-pr-files: false
41+
continue-on-error: true

next/.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["next", "next/typescript"]
3+
}

next/Dockerfile.prod

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ RUN \
2020

2121
# Rebuild the source code only when needed
2222
FROM base AS builder
23+
24+
# defaults for use during the container build phase on CI/CD
25+
ARG IMAGES_PROTOCOL=https
26+
ARG IMAGES_HOSTNAME=**
27+
ARG IMAGES_PORT=433
28+
2329
WORKDIR /app
2430
COPY --from=deps /app/node_modules ./node_modules
2531
COPY . .

next/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"private": true,
33
"scripts": {
44
"dev": "next dev",
5+
"lint": "next lint",
56
"build": "next build",
67
"start": "node .next/standalone/server.js",
78
"syncDataModel": "node bin/syncDataModel.js",

0 commit comments

Comments
 (0)