Skip to content

Commit 508de38

Browse files
authored
Improve project workflows (#555)
* feat: Improve project workflows * fix: Add package manager * fix: Update tseslint eslint plugin to fix CI
1 parent d67fad2 commit 508de38

9 files changed

Lines changed: 348 additions & 820 deletions

File tree

.github/actions/setup/action.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Setup
2+
description: Install pnpm and Node.js, and install dependencies with caching
3+
4+
inputs:
5+
registry-url:
6+
description: npm registry URL for authentication
7+
required: false
8+
default: ""
9+
10+
runs:
11+
using: composite
12+
steps:
13+
- name: Setup PNPM
14+
uses: pnpm/action-setup@v4
15+
with:
16+
run_install: false
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v6
20+
with:
21+
node-version-file: package.json
22+
cache: pnpm
23+
registry-url: ${{ inputs.registry-url }}
24+
25+
- name: Install dependencies
26+
shell: bash
27+
run: pnpm install --frozen-lockfile

.github/workflows/CODEQL.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,32 @@ on:
77
branches: [master]
88
workflow_dispatch:
99

10+
permissions: {}
11+
1012
jobs:
1113
analyze:
1214
name: Analyze
1315
runs-on: ubuntu-latest
14-
timeout-minutes: 360
16+
timeout-minutes: 30
1517
permissions:
1618
actions: read
1719
contents: read
1820
security-events: write
1921

20-
strategy:
21-
fail-fast: false
22-
matrix:
23-
language: ["javascript", "typescript"]
24-
2522
steps:
2623
- name: Checkout repository
2724
uses: actions/checkout@v6
28-
with:
29-
fetch-depth: 0
3025

3126
- name: Initialize CodeQL
3227
uses: github/codeql-action/init@v4
3328
with:
34-
languages: ${{ matrix.language }}
29+
languages: javascript-typescript
3530
queries: security-extended,security-and-quality
3631

3732
- name: CodeQL Autobuild
3833
uses: github/codeql-action/autobuild@v4
3934

4035
- name: CodeQL Analysis
4136
uses: github/codeql-action/analyze@v4
37+
with:
38+
category: /language:javascript-typescript

.github/workflows/continuous-deployment.yml

Lines changed: 13 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ on:
77

88
concurrency:
99
group: cd-${{ github.ref }}
10-
cancel-in-progress: true
10+
cancel-in-progress: false
11+
12+
permissions: {}
1113

1214
jobs:
1315
gh-pages:
@@ -18,31 +20,8 @@ jobs:
1820
- name: Checkout repository
1921
uses: actions/checkout@v6
2022

21-
- name: Setup Node.js
22-
uses: actions/setup-node@v6
23-
with:
24-
node-version: 25
25-
26-
- name: Setup PNPM
27-
uses: pnpm/action-setup@v4
28-
with:
29-
run_install: false
30-
31-
- name: Get pnpm store directory
32-
shell: bash
33-
run: |
34-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
35-
36-
- name: Setup pnpm cache
37-
uses: actions/cache@v5
38-
with:
39-
path: ${{ env.STORE_PATH }}
40-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
41-
restore-keys: |
42-
${{ runner.os }}-pnpm-store-
43-
44-
- name: Install dependencies
45-
run: pnpm install --frozen-lockfile
23+
- name: Setup environment
24+
uses: ./.github/actions/setup
4625

4726
- name: Build the demo application
4827
run: pnpm build:demo
@@ -55,49 +34,29 @@ jobs:
5534

5635
npm:
5736
runs-on: ubuntu-latest
58-
needs: gh-pages
5937
permissions:
6038
id-token: write
6139
contents: read
6240
packages: write
41+
environment: production
6342
steps:
6443
- name: Checkout repository
6544
uses: actions/checkout@v6
6645

67-
- name: Setup Node.js
68-
uses: actions/setup-node@v6
46+
- name: Setup environment
47+
uses: ./.github/actions/setup
6948
with:
70-
node-version: 25
7149
registry-url: "https://registry.npmjs.org"
7250

73-
- name: Setup PNPM
74-
uses: pnpm/action-setup@v4
75-
with:
76-
run_install: false
77-
78-
- name: Get pnpm store directory
79-
shell: bash
80-
run: |
81-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
82-
83-
- name: Setup pnpm cache
84-
uses: actions/cache@v5
85-
with:
86-
path: ${{ env.STORE_PATH }}
87-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
88-
restore-keys: |
89-
${{ runner.os }}-pnpm-store-
90-
91-
- name: Install dependencies
92-
run: pnpm install --frozen-lockfile
93-
9451
- name: Build the component
9552
run: pnpm build:component
9653

9754
- name: Run tests
9855
run: pnpm test
9956

10057
- name: Publish to NPM
101-
run: pnpm publish --access "public" --provenance --ignore-scripts
102-
env:
103-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
58+
uses: JS-DevTools/npm-publish@v4
59+
with:
60+
access: "public"
61+
provenance: true
62+
token: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)