Skip to content

Commit 12b6192

Browse files
committed
chore(ci): add workflows
1 parent 70c3033 commit 12b6192

File tree

9 files changed

+168
-1
lines changed

9 files changed

+168
-1
lines changed

.github/actions/prepare/action.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
description: Prepares the repo for a typical CI job
2+
3+
name: Prepare
4+
inputs:
5+
node-version: # id of input
6+
description: 'Node.js version'
7+
required: false
8+
default: '24'
9+
10+
runs:
11+
steps:
12+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
13+
with:
14+
node-version: ${{ inputs.node-version }}
15+
- name: Install dependencies
16+
uses: bahmutov/npm-install@4488656f8e90d3c85e3a964db0018dd624f340e7 # v1.11.1
17+
with:
18+
install-command: npm ci --foreground-scripts
19+
using: composite

.github/actions/publish/action.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish
2+
description: Publish to npm
3+
4+
inputs:
5+
token:
6+
description: 'npm token'
7+
required: true
8+
9+
runs:
10+
steps:
11+
# see https://github.com/google-github-actions/release-please-action#automating-publication-to-npm
12+
# see https://docs.npmjs.com/generating-provenance-statements
13+
- name: Checkout Repository
14+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
15+
- name: Setup Node.js
16+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
17+
with:
18+
node-version: 24.10.0
19+
registry-url: https://registry.npmjs.org
20+
- name: Install & Build
21+
uses: bahmutov/npm-install@4488656f8e90d3c85e3a964db0018dd624f340e7 # v1.11.1
22+
- name: Publish to npm
23+
env:
24+
NODE_AUTH_TOKEN: ${{ inputs.token }}
25+
run: npm publish --provenance --access public --registry https://registry.npmjs.org
26+
shell: bash
27+
using: composite

.github/workflows/commitlint.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Validate Commit Messages
2+
on: [pull_request]
3+
4+
permissions:
5+
contents: read
6+
7+
jobs:
8+
commitlint:
9+
env:
10+
FORCE_COLOR: '1'
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
15+
- uses: ./.github/actions/prepare
16+
- name: Run commitlint
17+
uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6
18+
env:
19+
NODE_PATH: ${{ github.workspace }}/node_modules

.github/workflows/lint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
permissions:
2+
contents: read
3+
4+
jobs:
5+
lint:
6+
env:
7+
FORCE_COLOR: '1'
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
11+
- uses: ./.github/actions/prepare
12+
- run: npm run lint
13+
14+
name: Lint
15+
16+
on: [push, pull_request]

.github/workflows/nodejs.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Node CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
env:
8+
FORCE_COLOR: '1'
9+
name: Build & Test
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
include:
14+
- node-version: '^22.12.0'
15+
- node-version: '^24.0.0'
16+
steps:
17+
- name: Checkout Repository
18+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
19+
- uses: ./.github/actions/prepare
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
- name: Test
23+
run: npm test
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Auto-assign PR to author
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, reopened]
6+
7+
permissions:
8+
pull-requests: write
9+
10+
jobs:
11+
assign-author:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: toshimaru/auto-author-assign@16f0022cf3d7970c106d8d1105f75a1165edb516 # v2.1.1

.github/workflows/publish.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Publish to npm
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
id-token: write
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout Repository
15+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
16+
- uses: ./.github/actions/publish
17+
with:
18+
token: ${{ secrets.NPM_TOKEN }}

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: release-please
2+
3+
concurrency:
4+
group: ${{ github.workflow }}
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
id-token: write
15+
16+
jobs:
17+
release-please:
18+
name: Release Please
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Create Release
22+
id: release
23+
uses: googleapis/release-please-action@c2a5a2bd6a758a0937f1ddb1e8950609867ed15c # v4.3.0
24+
- if: ${{ steps.release.outputs.release_created }}
25+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
26+
- if: ${{ steps.release.outputs.release_created }}
27+
uses: ./.github/actions/publish
28+
with:
29+
token: ${{ secrets.NPM_TOKEN }}

cspell.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@
4646
"wallabyjs",
4747
"qwen",
4848
"TKTK",
49-
"onsave"
49+
"onsave",
50+
"toshimaru",
51+
"wagoid"
5052
],
5153
"words": ["bupkis"]
5254
}

0 commit comments

Comments
 (0)