Skip to content

Commit 026065a

Browse files
committed
ci: modernize GitHub Actions (concurrency, permissions, matrix, caching, dispatch)\n\n- Update CI to matrix Node 18/20/22, add concurrency and least-privilege permissions\n- Add workflow_dispatch and paths-ignore, type-check step\n- Modernize Release workflow, add dispatch input, concurrency\n- Add Dependabot config for npm and GitHub Actions
1 parent 70e91b8 commit 026065a

File tree

3 files changed

+94
-18
lines changed

3 files changed

+94
-18
lines changed

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
version: 2
2+
updates:
3+
- package-ecosystem: 'npm'
4+
directory: '/'
5+
schedule:
6+
interval: 'weekly'
7+
open-pull-requests-limit: 10
8+
commit-message:
9+
prefix: 'deps'
10+
include: 'scope'
11+
- package-ecosystem: 'github-actions'
12+
directory: '/'
13+
schedule:
14+
interval: 'weekly'
15+
open-pull-requests-limit: 10
16+
commit-message:
17+
prefix: 'ci'
18+
include: 'scope'
19+
version: 2
220
updates:
321
- package-ecosystem: 'npm'
422
directory: '/'

.github/workflows/ci.yml

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,57 @@
11
name: CI
22
on:
33
pull_request:
4+
branches: [master, main]
5+
paths-ignore:
6+
- 'README.md'
7+
- 'readme-assets/**'
8+
- '.github/ISSUE_TEMPLATE/**'
9+
- '.github/PULL_REQUEST_TEMPLATE.md'
410
push:
511
branches: [master, main]
12+
paths-ignore:
13+
- 'README.md'
14+
- 'readme-assets/**'
15+
workflow_dispatch: {}
16+
17+
permissions:
18+
contents: read
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
624
jobs:
7-
ci:
25+
build-and-check:
826
runs-on: ubuntu-latest
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
node-version: [18, 20, 22]
931
steps:
10-
- uses: actions/checkout@v4
11-
- uses: pnpm/action-setup@v4
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
35+
- name: Setup pnpm
36+
uses: pnpm/action-setup@v4
1237
with:
1338
version: 9
14-
- uses: actions/setup-node@v4
39+
40+
- name: Setup Node.js ${{ matrix.node-version }}
41+
uses: actions/setup-node@v4
1542
with:
16-
node-version: 20
43+
node-version: ${{ matrix.node-version }}
1744
cache: pnpm
18-
- run: pnpm install --frozen-lockfile
19-
- run: pnpm lint:js
20-
- run: pnpm build
45+
46+
- name: Install dependencies
47+
run: pnpm install --frozen-lockfile
48+
49+
- name: Lint (JS only)
50+
run: pnpm lint:js
51+
52+
- name: Type check
53+
run: pnpm type-check
54+
55+
- name: Build library
56+
run: pnpm build
2157

.github/workflows/release.yml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,48 @@ name: Release
22
on:
33
push:
44
branches: [master, main]
5+
workflow_dispatch:
6+
inputs:
7+
publish:
8+
description: 'Publish to npm (yes/no)'
9+
required: false
10+
default: 'yes'
11+
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
id-token: write
16+
packages: write
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: false
21+
522
jobs:
623
release:
724
runs-on: ubuntu-latest
8-
permissions:
9-
contents: write
10-
pull-requests: write
11-
id-token: write
12-
packages: write
1325
steps:
14-
- uses: actions/checkout@v4
15-
- uses: pnpm/action-setup@v4
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Setup pnpm
30+
uses: pnpm/action-setup@v4
1631
with:
1732
version: 9
18-
- uses: actions/setup-node@v4
33+
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v4
1936
with:
2037
node-version: 20
2138
cache: pnpm
2239
registry-url: https://registry.npmjs.org
23-
- run: pnpm install --frozen-lockfile
24-
- run: pnpm build
40+
41+
- name: Install dependencies
42+
run: pnpm install --frozen-lockfile
43+
44+
- name: Build library
45+
run: pnpm build
46+
2547
- name: Create version PR or publish
2648
uses: changesets/action@v1
2749
with:

0 commit comments

Comments
 (0)