Skip to content

Commit b7c916d

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

File tree

3 files changed

+70
-46
lines changed

3 files changed

+70
-46
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@v4
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@v4
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@v4
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@v4
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: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ on:
55
- 'v*.*.*'
66

77
env:
8-
NODE_VERSION: '18'
8+
NODE_VERSION: '20.x'
9+
PNPM_VERSION: '10'
10+
11+
permissions:
12+
contents: read
913

1014
jobs:
1115
build-and-test:
@@ -22,22 +26,27 @@ jobs:
2226
with:
2327
node-version: ${{ env.NODE_VERSION }}
2428

29+
- name: Install pnpm
30+
uses: pnpm/action-setup@v4
31+
with:
32+
version: ${{ env.PNPM_VERSION }}
33+
2534
- name: Install dependencies
26-
run: npm ci
35+
run: pnpm install --frozen-lockfile
2736

2837
- name: Run build
29-
run: npm run build
38+
run: pnpm run build
3039

3140
- name: Run lint
32-
run: npm run lint
41+
run: pnpm run lint
3342
env:
3443
CI: true
3544

3645
- name: Run unit tests
37-
run: npm run test:unit
46+
run: pnpm run test:unit
3847

3948
- name: Run integration tests
40-
run: npm run test:integration
49+
run: pnpm run test:integration
4150
env:
4251
HOST: ${{ secrets.HOST }}
4352
EMAIL: ${{ secrets.EMAIL }}
@@ -47,6 +56,8 @@ jobs:
4756
name: Publish Package
4857
needs: build-and-test
4958
runs-on: ubuntu-latest
59+
permissions:
60+
contents: write
5061
steps:
5162
- name: Checkout repository
5263
uses: actions/checkout@v4
@@ -59,10 +70,14 @@ jobs:
5970
node-version: ${{ env.NODE_VERSION }}
6071
registry-url: 'https://registry.npmjs.org'
6172

73+
- name: Install pnpm
74+
uses: pnpm/action-setup@v4
75+
with:
76+
version: ${{ env.PNPM_VERSION }}
77+
6278
- name: Get and validate version
6379
id: version
6480
run: |
65-
# Get version from tag if exists
6681
if [[ $GITHUB_REF == refs/tags/v* ]]; then
6782
TAG_VERSION=${GITHUB_REF#refs/tags/v}
6883
echo "Using version from tag: $TAG_VERSION"
@@ -71,10 +86,10 @@ jobs:
7186
if [ "$TAG_VERSION" != "$CURRENT_VERSION" ]; then
7287
echo "Updating package version to match tag..."
7388
npm version $TAG_VERSION --no-git-tag-version
74-
npm install
89+
pnpm install
7590
git config user.name "GitHub Actions"
7691
git config user.email "[email protected]"
77-
git add package.json package-lock.json
92+
git add package.json pnpm-lock.yaml
7893
git commit -m "Update version to $TAG_VERSION [skip ci]"
7994
git push
8095
fi
@@ -89,13 +104,13 @@ jobs:
89104
GITHUB_TOKEN: ${{ secrets.PAT }}
90105

91106
- name: Install dependencies
92-
run: npm ci
107+
run: pnpm install --frozen-lockfile
93108

94109
- name: Build package
95-
run: npm run build
110+
run: pnpm run build
96111

97112
- name: Publish to NPM
98-
run: npm publish
113+
run: pnpm publish
99114
env:
100115
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
101116

@@ -114,11 +129,16 @@ jobs:
114129
with:
115130
node-version: ${{ env.NODE_VERSION }}
116131

132+
- name: Install pnpm
133+
uses: pnpm/action-setup@v4
134+
with:
135+
version: ${{ env.PNPM_VERSION }}
136+
117137
- name: Install dependencies
118-
run: npm ci
138+
run: pnpm install --frozen-lockfile
119139

120140
- name: Generate documentation
121-
run: npm run doc
141+
run: pnpm run doc
122142

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

0 commit comments

Comments
 (0)