Skip to content

Commit a4327e2

Browse files
committed
CI/CD improvements
1 parent 411d083 commit a4327e2

File tree

3 files changed

+56
-45
lines changed

3 files changed

+56
-45
lines changed

.github/workflows/ci.yaml

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,54 @@ on:
55
repository_dispatch:
66
types: [ pr-approved ]
77

8+
env:
9+
PNPM_VERSION: '10'
10+
811
jobs:
912
build:
1013
name: Build
1114
runs-on: ubuntu-latest
1215
strategy:
1316
matrix:
14-
node-version: [18.x, 20.x]
17+
node-version: [20.x, 22.x]
1518
steps:
1619
- name: Checkout sources
1720
uses: actions/checkout@v4
1821
- name: Use Node.js ${{ matrix.node-version }}
1922
uses: actions/setup-node@v4
2023
with:
2124
node-version: ${{ matrix.node-version }}
25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v2
27+
with:
28+
version: ${{ env.PNPM_VERSION }}
2229
- name: Installing dependencies
23-
run: npm ci
30+
run: pnpm install --frozen-lockfile
2431
- name: Building sources
25-
run: npm run build
32+
run: pnpm run build
2633

2734
lint:
2835
name: Lint Code
2936
needs: build
3037
runs-on: ubuntu-latest
3138
strategy:
3239
matrix:
33-
node-version: [18.x, 20.x]
40+
node-version: [20.x, 22.x]
3441
steps:
3542
- name: Checkout sources
3643
uses: actions/checkout@v4
3744
- name: Use Node.js ${{ matrix.node-version }}
3845
uses: actions/setup-node@v4
3946
with:
4047
node-version: ${{ matrix.node-version }}
48+
- name: Install pnpm
49+
uses: pnpm/action-setup@v2
50+
with:
51+
version: ${{ env.PNPM_VERSION }}
4152
- name: Installing dependencies
42-
run: npm ci
53+
run: pnpm install --frozen-lockfile
4354
- name: Linting
44-
run: npm run lint
55+
run: pnpm run lint
4556
env:
4657
CI: true
4758

@@ -51,18 +62,22 @@ jobs:
5162
runs-on: ubuntu-latest
5263
strategy:
5364
matrix:
54-
node-version: [18.x, 20.x]
65+
node-version: [20.x, 22.x]
5566
steps:
5667
- name: Checkout sources
5768
uses: actions/checkout@v4
5869
- name: Use Node.js ${{ matrix.node-version }}
5970
uses: actions/setup-node@v4
6071
with:
6172
node-version: ${{ matrix.node-version }}
73+
- name: Install pnpm
74+
uses: pnpm/action-setup@v2
75+
with:
76+
version: ${{ env.PNPM_VERSION }}
6277
- name: Installing dependencies
63-
run: npm ci
78+
run: pnpm install --frozen-lockfile
6479
- name: Running unit tests
65-
run: npm run test:unit
80+
run: pnpm run test:unit
6681

6782
test_integration:
6883
name: Integration Tests
@@ -73,21 +88,25 @@ jobs:
7388
strategy:
7489
max-parallel: 1
7590
matrix:
76-
node-version: [18.x, 20.x]
91+
node-version: [20.x, 22.x]
7792
steps:
7893
- name: Checkout sources
7994
uses: actions/checkout@v4
8095
- name: Use Node.js ${{ matrix.node-version }}
8196
uses: actions/setup-node@v4
8297
with:
8398
node-version: ${{ matrix.node-version }}
99+
- name: Install pnpm
100+
uses: pnpm/action-setup@v2
101+
with:
102+
version: ${{ env.PNPM_VERSION }}
84103
- name: Installing dependencies
85-
run: npm ci
104+
run: pnpm install --frozen-lockfile
86105
- name: Creating `.env` file
87106
run: |
88107
touch .env
89108
echo HOST=${{ secrets.HOST }} >> .env
90109
echo EMAIL=${{ secrets.EMAIL }} >> .env
91110
echo API_TOKEN=${{ secrets.API_TOKEN }} >> .env
92111
- name: Running integration tests
93-
run: npm run test:integration
112+
run: pnpm run test:integration

.github/workflows/publish-dev.yml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,22 @@ name: Publish to NPM Dev Channel
33
on:
44
workflow_dispatch
55

6+
permissions:
7+
contents: read
8+
9+
610
jobs:
711
build-and-publish:
812
runs-on: ubuntu-latest
913

1014
steps:
1115
- name: Checkout code
1216
uses: actions/checkout@v4
13-
with:
14-
fetch-depth: 0
15-
16-
- name: Check branch
17-
run: |
18-
if [ "$GITHUB_REF" != "refs/heads/develop" ]; then
19-
echo "This workflow can only be run on the 'develop' branch."
20-
exit 1
21-
fi
2217

2318
- name: Set up Node.js
2419
uses: actions/setup-node@v4
2520
with:
26-
node-version: 18
21+
node-version: 20
2722
registry-url: https://registry.npmjs.org/
2823

2924
- name: Install dependencies
@@ -45,16 +40,6 @@ jobs:
4540
- name: Update package-lock.json
4641
run: npm install
4742

48-
- name: Commit version update
49-
run: |
50-
git config --global user.name "GitHub Actions"
51-
git config --global user.email "[email protected]"
52-
git add package.json package-lock.json
53-
git commit -m "Update version to $NEW_VERSION [skip ci]"
54-
git push origin develop
55-
env:
56-
GITHUB_TOKEN: ${{ secrets.PAT }}
57-
5843
- name: Publish to NPM Dev Channel
5944
run: npm publish --tag dev
6045
env:

.github/workflows/publish.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
env:
88
NODE_VERSION: '18'
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
build-and-test:
1215
name: Build and Test
@@ -21,23 +24,24 @@ jobs:
2124
uses: actions/setup-node@v4
2225
with:
2326
node-version: ${{ env.NODE_VERSION }}
27+
package-manager: 'pnpm'
2428

2529
- name: Install dependencies
26-
run: npm ci
30+
run: pnpm install --frozen-lockfile
2731

2832
- name: Run build
29-
run: npm run build
33+
run: pnpm run build
3034

3135
- name: Run lint
32-
run: npm run lint
36+
run: pnpm run lint
3337
env:
3438
CI: true
3539

3640
- name: Run unit tests
37-
run: npm run test:unit
41+
run: pnpm run test:unit
3842

3943
- name: Run integration tests
40-
run: npm run test:integration
44+
run: pnpm run test:integration
4145
env:
4246
HOST: ${{ secrets.HOST }}
4347
EMAIL: ${{ secrets.EMAIL }}
@@ -47,6 +51,8 @@ jobs:
4751
name: Publish Package
4852
needs: build-and-test
4953
runs-on: ubuntu-latest
54+
permissions:
55+
contents: write
5056
steps:
5157
- name: Checkout repository
5258
uses: actions/checkout@v4
@@ -58,11 +64,11 @@ jobs:
5864
with:
5965
node-version: ${{ env.NODE_VERSION }}
6066
registry-url: 'https://registry.npmjs.org'
67+
package-manager: 'pnpm'
6168

6269
- name: Get and validate version
6370
id: version
6471
run: |
65-
# Get version from tag if exists
6672
if [[ $GITHUB_REF == refs/tags/v* ]]; then
6773
TAG_VERSION=${GITHUB_REF#refs/tags/v}
6874
echo "Using version from tag: $TAG_VERSION"
@@ -71,10 +77,10 @@ jobs:
7177
if [ "$TAG_VERSION" != "$CURRENT_VERSION" ]; then
7278
echo "Updating package version to match tag..."
7379
npm version $TAG_VERSION --no-git-tag-version
74-
npm install
80+
pnpm install
7581
git config user.name "GitHub Actions"
7682
git config user.email "[email protected]"
77-
git add package.json package-lock.json
83+
git add package.json pnpm-lock.yaml
7884
git commit -m "Update version to $TAG_VERSION [skip ci]"
7985
git push
8086
fi
@@ -89,13 +95,13 @@ jobs:
8995
GITHUB_TOKEN: ${{ secrets.PAT }}
9096

9197
- name: Install dependencies
92-
run: npm ci
98+
run: pnpm install --frozen-lockfile
9399

94100
- name: Build package
95-
run: npm run build
101+
run: pnpm run build
96102

97103
- name: Publish to NPM
98-
run: npm publish
104+
run: pnpm publish
99105
env:
100106
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
101107

@@ -113,12 +119,13 @@ jobs:
113119
uses: actions/setup-node@v4
114120
with:
115121
node-version: ${{ env.NODE_VERSION }}
122+
package-manager: 'pnpm'
116123

117124
- name: Install dependencies
118-
run: npm ci
125+
run: pnpm install --frozen-lockfile
119126

120127
- name: Generate documentation
121-
run: npm run doc
128+
run: pnpm run doc
122129

123130
- name: Deploy to docs branch
124131
uses: JamesIves/github-pages-deploy-action@v4

0 commit comments

Comments
 (0)