-
Notifications
You must be signed in to change notification settings - Fork 36
80 lines (66 loc) · 2.17 KB
/
Copy pathbuild.yml
File metadata and controls
80 lines (66 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Build & Test Next.js site
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [master]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Detect package manager
id: pm
run: |
# Prefer pnpm, then yarn, otherwise npm
if [ -f pnpm-lock.yaml ]; then
echo "manager=pnpm" >> $GITHUB_OUTPUT
echo "install=install --frozen-lockfile" >> $GITHUB_OUTPUT
echo "runner=pnpm run" >> $GITHUB_OUTPUT
elif [ -f yarn.lock ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "install=install --immutable" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
else
echo "manager=npm" >> $GITHUB_OUTPUT
echo "install=ci" >> $GITHUB_OUTPUT
echo "runner=npm run" >> $GITHUB_OUTPUT
fi
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
# Corepack must be enabled *after* setup-node so the Yarn 4 shim attaches
# to the Node that runs the build. (setup-node's built-in `cache: yarn`
# is intentionally omitted: its `yarn cache dir` probe runs the runner's
# Yarn 1, which aborts on the `packageManager: yarn@4` pin.)
- name: Enable Corepack
run: corepack enable
- name: Install Foomatic system packages
run: |
sudo apt-get update
sudo apt-get install -y \
foomatic-db-engine \
foomatic-db-compressed-ppds \
cups-filters \
ghostscript \
bsdmainutils \
libxml2-utils \
xsltproc \
python3 \
python3-pip
- name: Install dependencies
run: ${{ steps.pm.outputs.manager }} ${{ steps.pm.outputs.install }}
- name: Run linter
run: ${{ steps.pm.outputs.runner }} lint
- name: Build Next.js
run: ${{ steps.pm.outputs.runner }} build