generated from chiffre-io/template-library
-
-
Notifications
You must be signed in to change notification settings - Fork 102
130 lines (124 loc) · 4.79 KB
/
ci-cd.yml
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: CI/CD
on:
push:
branches:
- master
- beta
- next
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:
env:
FORCE_COLOR: 3 # Diplay chalk colors
jobs:
ci:
# Watch out! When changing the job name,
# update the required checks in GitHub
# branch protection settings for `next`.
name: CI (${{ matrix.next-version }}${{ matrix.base-path && ' basePath' || ''}})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Watch out! When changing the compat grid,
# update the required checks in GitHub
# branch protection settings for `next`.
base-path: [false, '/base']
next-version:
# Only keep versions where there were relevant changes in the app router core,
# and the previous one to use as a baseline.
- '14.2.0'
- '14.2.3' # before vercel/next.js#66755
- '14.2.4' # after vercel/next.js#66755
- '14.2.7' # before vercel/next.js#69509
- '14.2.8' # after vercel/next.js#69509
- '15.0.0'
- latest
- local
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
with:
node-version-file: .node-version
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Install Next.js version ${{ matrix.next-version }}
if: ${{ matrix.next-version != 'local' }}
run: pnpm add --filter e2e --filter nuqs next@${{ matrix.next-version }}
- name: Run integration tests
run: pnpm run test ${{ github.event_name == 'workflow_dispatch' && '--force' || '' }}
env:
BASE_PATH: ${{ matrix.base-path && matrix.base-path || '/' }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
E2E_NO_CACHE_ON_RERUN: ${{ github.run_attempt }}
- name: Save Cypress artifacts
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874
if: failure()
with:
path: packages/e2e/cypress/screenshots
name: ci-${{ matrix.next-version }}${{ matrix.base-path && '-basePath' || ''}}
- uses: 47ng/actions-slack-notify@main
name: Notify on Slack
if: always()
with:
status: ${{ job.status }}
jobName: next@${{ matrix.next-version }}${{ matrix.base-path && ' basePath' || ''}}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
lint:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
with:
node-version-file: .node-version
cache: pnpm
- name: Install dependencies
run: pnpm install --ignore-scripts --frozen-lockfile
- name: Check monorepo with Sherif
run: pnpm run lint:sherif
- name: Check source code formatting
run: |
set +e # Allow Prettier to fail, but capture the error code
output=$(./node_modules/.bin/prettier --list-different ./packages/nuqs 2>&1)
exit_code=$?
set -e
if [ $exit_code -ne 0 ]; then
echo "$output" | while IFS= read -r file; do
echo "::warning file=$file::Prettier detected formatting issues in $file"
done
exit $exit_code
else
echo "No formatting issues found"
fi
cd:
name: Deployment
runs-on: ubuntu-latest
needs: [ci]
if: ${{ github.ref_name == 'master' || github.ref_name == 'beta' }}
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
with:
node-version-file: .node-version
cache: pnpm
# Note: we do not use an external Turbo cache for publishing
# to prevent against possible cache collision attacks.
- name: Install dependencies
run: pnpm install --ignore-scripts --frozen-lockfile
- name: Build package
run: pnpm build --filter nuqs
- name: Semantic Release
run: ../../node_modules/.bin/semantic-release
working-directory: packages/nuqs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Invalidate ISR cache for NPM in the docs
run: curl -s "https://nuqs.47ng.com/api/isr?tag=npm&token=${{ secrets.ISR_TOKEN }}"