Skip to content

Commit 60025b2

Browse files
committed
chore(gha): update npm.yml GitHub workflow
1 parent 77ecccf commit 60025b2

1 file changed

Lines changed: 71 additions & 35 deletions

File tree

‎.github/workflows/npm.yml‎

Lines changed: 71 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,58 @@ name: NPM
1414
jobs:
1515
packagejsonlint:
1616
name: PackageJsonLint
17-
runs-on: ubuntu-20.04
17+
runs-on: ubuntu-24.04
1818
timeout-minutes: 1
1919
steps:
20-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v7
2121
- uses: mobsuccess-devops/github-actions-packagejsonlint@master
22+
sortpackagejson:
23+
name: Sort Package Json
24+
runs-on: ubuntu-24.04
25+
timeout-minutes: 7
26+
steps:
27+
- uses: actions/checkout@v7
28+
- uses: actions/setup-node@v7
29+
with:
30+
node-version: 24
31+
- run: npm install -g npm@11.10.0
32+
name: Upgrade npm
33+
- name: Cache Node Modules
34+
id: cache
35+
uses: actions/cache@v6
36+
env:
37+
cache-name: cache-node-modules
38+
with:
39+
path: ./node_modules
40+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-24
41+
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
42+
name: Configure Credentials For GitHub Packages
43+
- run: npm ci
44+
if: steps.cache.outputs.cache-hit != 'true'
45+
working-directory: .
46+
- run: |
47+
echo "💡 👉 Check not passing? see the doc at https://www.notion.so/mobsuccess/sort-package-json-de5cf4648e8545dbb5a2a5a910380535"
48+
npx --yes sort-package-json@2.4.1 --check
49+
working-directory: .
2250
prettier:
2351
name: Prettier
24-
runs-on: ubuntu-20.04
52+
runs-on: ubuntu-24.04
2553
timeout-minutes: 7
2654
steps:
27-
- uses: actions/checkout@v3
28-
- uses: actions/setup-node@v3
55+
- uses: actions/checkout@v7
56+
- uses: actions/setup-node@v7
2957
with:
30-
node-version: 16.16.0
58+
node-version: 24
59+
- run: npm install -g npm@11.10.0
60+
name: Upgrade npm
3161
- name: Cache Node Modules
3262
id: cache
33-
uses: actions/cache@v3
63+
uses: actions/cache@v6
3464
env:
3565
cache-name: cache-node-modules
3666
with:
3767
path: ./node_modules
38-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
68+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-24
3969
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
4070
name: Configure Credentials For GitHub Packages
4171
- run: npm ci
@@ -45,21 +75,23 @@ jobs:
4575
working-directory: .
4676
eslint:
4777
name: Eslint
48-
runs-on: ubuntu-20.04
78+
runs-on: ubuntu-24.04
4979
timeout-minutes: 7
5080
steps:
51-
- uses: actions/checkout@v3
52-
- uses: actions/setup-node@v3
81+
- uses: actions/checkout@v7
82+
- uses: actions/setup-node@v7
5383
with:
54-
node-version: 16.16.0
84+
node-version: 24
85+
- run: npm install -g npm@11.10.0
86+
name: Upgrade npm
5587
- name: Cache Node Modules
5688
id: cache
57-
uses: actions/cache@v3
89+
uses: actions/cache@v6
5890
env:
5991
cache-name: cache-node-modules
6092
with:
6193
path: ./node_modules
62-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
94+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-24
6395
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
6496
name: Configure Credentials For GitHub Packages
6597
- run: npm ci
@@ -69,21 +101,23 @@ jobs:
69101
working-directory: .
70102
test:
71103
name: Test
72-
runs-on: ubuntu-20.04
104+
runs-on: ubuntu-24.04
73105
timeout-minutes: 7
74106
steps:
75-
- uses: actions/checkout@v3
76-
- uses: actions/setup-node@v3
107+
- uses: actions/checkout@v7
108+
- uses: actions/setup-node@v7
77109
with:
78-
node-version: 16.16.0
110+
node-version: 24
111+
- run: npm install -g npm@11.10.0
112+
name: Upgrade npm
79113
- name: Cache Node Modules
80114
id: cache
81-
uses: actions/cache@v3
115+
uses: actions/cache@v6
82116
env:
83117
cache-name: cache-node-modules
84118
with:
85119
path: ./node_modules
86-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
120+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-24
87121
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
88122
name: Configure Credentials For GitHub Packages
89123
- run: npm ci
@@ -92,9 +126,9 @@ jobs:
92126
- run: npm run test
93127
working-directory: .
94128
postBuild:
95-
needs: [packagejsonlint, prettier, eslint, test]
129+
needs: [packagejsonlint, sortpackagejson, prettier, eslint, test]
96130
name: Post-Build
97-
runs-on: ubuntu-20.04
131+
runs-on: ubuntu-24.04
98132
timeout-minutes: 2
99133
outputs:
100134
needsPackage: ${{ steps.checkEligibility.outputs.needsPackage }}
@@ -128,24 +162,26 @@ jobs:
128162
package:
129163
needs: [postBuild]
130164
name: Package
131-
runs-on: ubuntu-20.04
165+
runs-on: ubuntu-24.04
132166
timeout-minutes: 2
133167
outputs:
134168
packageVersion: ${{ steps.outputPackageVersion.outputs.packageVersion }}
135169
if: needs.postBuild.outputs.needsPackage == 'true'
136170
steps:
137-
- uses: actions/checkout@v3
138-
- uses: actions/setup-node@v3
171+
- uses: actions/checkout@v7
172+
- uses: actions/setup-node@v7
139173
with:
140-
node-version: 16.16.0
174+
node-version: 24
175+
- run: npm install -g npm@11.10.0
176+
name: Upgrade npm
141177
- name: Cache Node Modules
142178
id: cache
143-
uses: actions/cache@v3
179+
uses: actions/cache@v6
144180
env:
145181
cache-name: cache-node-modules
146182
with:
147183
path: ./node_modules
148-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
184+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-24
149185
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
150186
name: Configure Credentials For GitHub Packages
151187
- run: npm ci
@@ -189,25 +225,25 @@ jobs:
189225
- run: npm pack
190226
working-directory: .
191227
- name: Upload
192-
uses: actions/upload-artifact@v2
228+
uses: actions/upload-artifact@v7
193229
with:
194230
name: package
195231
path: "*.tgz"
196232
publish:
197233
name: "Publish to GitHub Packages"
198234
needs: [postBuild, package]
199-
runs-on: ubuntu-20.04
235+
runs-on: ubuntu-24.04
200236
timeout-minutes: 2
201237
if: needs.postBuild.outputs.needsPackage == 'true'
202238
steps:
203-
- uses: actions/checkout@v3
204-
- name: Upload
205-
uses: actions/download-artifact@v2
239+
- uses: actions/checkout@v7
240+
- name: Download
241+
uses: actions/download-artifact@v8
206242
with:
207243
name: package
208-
- uses: actions/setup-node@v3
244+
- uses: actions/setup-node@v7
209245
with:
210-
node-version: 16.16.0
246+
node-version: 24
211247
registry-url: https://npm.pkg.github.com/
212248
scope: "@mobsuccess-devops"
213249
- run: echo "registry=https://npm.pkg.github.com/@mobsuccess-devops" >> .npmrc

0 commit comments

Comments
 (0)