Skip to content

Commit 7210544

Browse files
committed
Refactor CI and add publish workflow with Publint integration
1 parent 7a1f122 commit 7210544

File tree

4 files changed

+143
-29
lines changed

4 files changed

+143
-29
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,41 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88

99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v6
14+
- uses: actions/checkout@v6
1515

16-
- name: Setup Node.js
17-
uses: actions/setup-node@v6
18-
with:
19-
node-version: '24'
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v6
18+
with:
19+
node-version: "24"
2020

21-
- name: Install dependencies
22-
run: npm ci
21+
- name: Install dependencies
22+
run: npm ci
2323

24-
- name: Build
25-
run: npm run build
24+
- name: Build
25+
run: npm run build
2626

2727
lint:
2828
runs-on: ubuntu-latest
2929

3030
steps:
31-
- uses: actions/checkout@v6
31+
- uses: actions/checkout@v6
3232

33-
- name: Setup Node.js
34-
uses: actions/setup-node@v6
35-
with:
36-
node-version: '24'
33+
- name: Setup Node.js
34+
uses: actions/setup-node@v6
35+
with:
36+
node-version: "24"
3737

38-
- name: Install dependencies
39-
run: npm ci
38+
- name: Install dependencies
39+
run: npm ci
4040

41-
- name: Run lint
42-
run: npm run lint
41+
- name: Run lint
42+
run: npm run lint

.github/workflows/publish.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]+"
7+
8+
jobs:
9+
publish:
10+
name: Publish
11+
runs-on: ubuntu-latest
12+
if: ${{ github.repository_owner == 'playcanvas' }}
13+
permissions:
14+
contents: write
15+
id-token: write
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v6
19+
20+
- name: Set up Node.js 24.x
21+
uses: actions/setup-node@v6
22+
with:
23+
node-version: 24.x
24+
cache: "npm"
25+
registry-url: "https://registry.npmjs.org/"
26+
27+
- name: Install Dependencies
28+
run: npm ci
29+
30+
- name: Build Web Components
31+
run: npm run build
32+
env:
33+
NODE_ENV: production
34+
35+
- name: Run Publint
36+
run: npm run publint
37+
38+
- name: Publish to npm
39+
run: npm publish --provenance
40+
41+
- name: Create GitHub Release
42+
uses: softprops/action-gh-release@v2
43+
with:
44+
generate_release_notes: true
45+
prerelease: false
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package-lock.json

Lines changed: 74 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"lint": "eslint examples/js examples/assets/scripts src",
3333
"serve": "serve",
3434
"test": "echo \"Error: no test specified\" && exit 1",
35+
"publint": "publint",
3536
"type-check": "tsc --noEmit",
3637
"type-check:watch": "npm run type-check -- --watch",
3738
"watch": "rollup -c -w"
@@ -54,6 +55,7 @@
5455
"mediabunny": "1.26.0",
5556
"opentype.js": "1.3.4",
5657
"playcanvas": "2.14.3",
58+
"publint": "^0.3.16",
5759
"rollup": "4.53.4",
5860
"serve": "14.2.5",
5961
"tslib": "2.8.1",

0 commit comments

Comments
 (0)