Skip to content

Commit bab6089

Browse files
committed
ci: use reuseable workflows
1 parent 8462431 commit bab6089

2 files changed

Lines changed: 30 additions & 123 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -12,77 +12,23 @@ on:
1212
workflow_dispatch:
1313

1414
jobs:
15-
lint:
16-
runs-on: ubuntu-latest
17-
if: github.event_name != 'pull_request'
18-
env:
19-
GITHUB_TOKEN: ${{ secrets.GitHub_TOKEN }}
20-
steps:
21-
- name: Checkout
22-
uses: actions/checkout@v6
23-
24-
- name: Setup pnpm
25-
uses: pnpm/action-setup@v4
26-
27-
- name: Setup Node.js
28-
uses: actions/setup-node@v6
29-
with:
30-
node-version: 24.11.1
31-
cache: pnpm
32-
33-
- name: Install deps
34-
run: pnpm install
35-
36-
- name: Lint
37-
run: pnpm lint:check
38-
3915
test:
4016
runs-on: ubuntu-latest
41-
env:
42-
GITHUB_TOKEN: ${{ secrets.GitHub_TOKEN }}
4317
steps:
44-
- name: Checkout
45-
uses: actions/checkout@v6
46-
47-
- name: Setup pnpm
48-
uses: pnpm/action-setup@v4
49-
50-
- name: Setup Node.js
51-
uses: actions/setup-node@v6
52-
with:
53-
node-version: 24.11.1
54-
cache: pnpm
55-
56-
- name: Install deps
57-
run: pnpm install
18+
- name: Setup JS
19+
uses: zotero-plugin-dev/workflows/setup-js@main
5820

5921
- name: Test
60-
run: |
61-
pnpm test
22+
run: pnpm test
6223

6324
build:
6425
runs-on: ubuntu-latest
65-
env:
66-
GITHUB_TOKEN: ${{ secrets.GitHub_TOKEN }}
6726
steps:
68-
- name: Checkout
69-
uses: actions/checkout@v6
70-
71-
- name: Setup pnpm
72-
uses: pnpm/action-setup@v4
73-
74-
- name: Setup Node.js
75-
uses: actions/setup-node@v6
76-
with:
77-
node-version: 24.11.1
78-
cache: pnpm
79-
80-
- name: Install deps
81-
run: pnpm install
27+
- name: Setup JS
28+
uses: zotero-plugin-dev/workflows/setup-js@main
8229

8330
- name: Build Packages
84-
run: |
85-
pnpm build
31+
run: pnpm build
8632

8733
- name: Upload build result
8834
uses: actions/upload-artifact@v5
@@ -103,31 +49,19 @@ jobs:
10349
pages: write
10450
id-token: write
10551
steps:
106-
- name: Checkout
107-
uses: actions/checkout@v6
52+
- name: Setup JS
53+
uses: zotero-plugin-dev/workflows/setup-js@main
10854
with:
109-
fetch-depth: 0
55+
fetch-all: 0
11056

11157
- name: Restore Build Result
11258
uses: actions/download-artifact@v6
11359
with:
11460
name: build-result
11561

116-
- name: Setup pnpm
117-
uses: pnpm/action-setup@v4
118-
119-
- name: Setup Node.js
120-
uses: actions/setup-node@v6
121-
with:
122-
node-version: 24.11.1
123-
cache: pnpm
124-
12562
- name: Setup Pages
12663
uses: actions/configure-pages@v5
12764

128-
- name: Install deps
129-
run: pnpm install
130-
13165
- name: Build Documentation
13266
run: pnpm docs:build
13367

@@ -140,51 +74,3 @@ jobs:
14074
if: github.event_name == 'push'
14175
id: deployment
14276
uses: actions/deploy-pages@v4
143-
144-
publish:
145-
runs-on: ubuntu-latest
146-
if: github.event_name == 'push' || github.event_name == 'pull_request'
147-
needs:
148-
- build
149-
env:
150-
GITHUB_TOKEN: ${{ secrets.GitHub_TOKEN }}
151-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
152-
permissions:
153-
contents: write
154-
issues: write
155-
pull-requests: write
156-
id-token: write
157-
steps:
158-
- name: Checkout
159-
uses: actions/checkout@v6
160-
with:
161-
fetch-depth: 0
162-
163-
- name: Restore Build Result
164-
uses: actions/download-artifact@v6
165-
with:
166-
name: build-result
167-
168-
- name: Setup pnpm
169-
uses: pnpm/action-setup@v4
170-
171-
- name: Setup Node.js
172-
uses: actions/setup-node@v6
173-
with:
174-
node-version: 24.11.1
175-
registry-url: https://registry.npmjs.org/
176-
cache: pnpm
177-
178-
- run: pnpm i
179-
180-
- name: Publish to NPM and sync to GitHub
181-
if: github.event_name == 'push' && github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')
182-
run: |
183-
pnpm publish --no-git-checks
184-
pnpx changelogithub
185-
env:
186-
NPM_CONFIG_PROVENANCE: true
187-
188-
- name: Publish to pkg-pr-new
189-
if: github.ref_type != 'tag'
190-
run: pnpx pkg-pr-new publish --compact --no-template --pnpm

.github/workflows/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- v**
9+
pull_request:
10+
branches:
11+
- main
12+
13+
jobs:
14+
release:
15+
uses: zotero-plugin-dev/workflows/.github/workflows/release-npm.yml@main
16+
with:
17+
build: pnpm build
18+
cr: true
19+
permissions:
20+
contents: write
21+
id-token: write

0 commit comments

Comments
 (0)