Skip to content

Commit e0cde76

Browse files
committed
ci: add CI workflow with type check, build, verify and dry-run publish
Runs on every push and PR across all branches. Checks: - TypeScript (server + admin) - Build - Strapi plugin verify - Version not already published on npm - Dry run publish publish.yml now requires CI to pass before publishing to npm.
1 parent d28d546 commit e0cde76

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ['**']
6+
pull_request:
7+
branches: ['**']
8+
workflow_call:
9+
10+
jobs:
11+
ci:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
registry-url: 'https://registry.npmjs.org'
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Type check (server)
28+
run: npm run test:ts:back
29+
30+
- name: Type check (admin)
31+
run: npm run test:ts:front
32+
33+
- name: Build
34+
run: npm run build
35+
36+
- name: Verify plugin
37+
run: npm run verify
38+
39+
- name: Check version not already published
40+
run: |
41+
VERSION=$(node -p "require('./package.json').version")
42+
if npm view strapi-plugin-form-builder-cms@$VERSION version 2>/dev/null; then
43+
echo "❌ Version $VERSION is already published on npm. Bump the version before merging."
44+
exit 1
45+
fi
46+
echo "✅ Version $VERSION is not yet published."
47+
48+
- name: Dry run publish
49+
run: npm publish --dry-run --access public

.github/workflows/publish.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
jobs:
1010
publish:
1111
if: github.event.pull_request.merged == true
12+
needs: ci
1213
runs-on: ubuntu-latest
1314

1415
steps:
@@ -44,3 +45,6 @@ jobs:
4445
body: |
4546
Published from PR #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}
4647
generate_release_notes: true
48+
49+
ci:
50+
uses: ./.github/workflows/ci.yml

0 commit comments

Comments
 (0)