Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 70 additions & 34 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,58 @@ name: NPM
jobs:
packagejsonlint:
name: PackageJsonLint
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 1
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
- uses: mobsuccess-devops/github-actions-packagejsonlint@master
sortpackagejson:
name: Sort Package Json
runs-on: ubuntu-24.04
timeout-minutes: 7
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
- run: npm install -g npm@11.10.0
name: Upgrade npm
- name: Cache Node Modules
id: cache
uses: actions/cache@v5
env:
cache-name: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-24
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
name: Configure Credentials For GitHub Packages
- run: npm ci
if: steps.cache.outputs.cache-hit != 'true'
working-directory: .
- run: |
echo "💡 👉 Check not passing? see the doc at https://www.notion.so/mobsuccess/sort-package-json-de5cf4648e8545dbb5a2a5a910380535"
npx --yes sort-package-json@2.4.1 --check
working-directory: .
prettier:
name: Prettier
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 7
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 16.16.0
node-version: 24
- run: npm install -g npm@11.10.0
name: Upgrade npm
- name: Cache Node Modules
id: cache
uses: actions/cache@v3
uses: actions/cache@v5
env:
cache-name: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-24
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
name: Configure Credentials For GitHub Packages
- run: npm ci
Expand All @@ -45,21 +75,23 @@ jobs:
working-directory: .
eslint:
name: Eslint
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 7
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 16.16.0
node-version: 24
- run: npm install -g npm@11.10.0
name: Upgrade npm
- name: Cache Node Modules
id: cache
uses: actions/cache@v3
uses: actions/cache@v5
env:
cache-name: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-24
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
name: Configure Credentials For GitHub Packages
- run: npm ci
Expand All @@ -69,21 +101,23 @@ jobs:
working-directory: .
test:
name: Test
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 7
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 16.16.0
node-version: 24
- run: npm install -g npm@11.10.0
name: Upgrade npm
- name: Cache Node Modules
id: cache
uses: actions/cache@v3
uses: actions/cache@v5
env:
cache-name: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-24
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
name: Configure Credentials For GitHub Packages
- run: npm ci
Expand All @@ -92,9 +126,9 @@ jobs:
- run: npm run test
working-directory: .
postBuild:
needs: [packagejsonlint, prettier, eslint, test]
needs: [packagejsonlint, sortpackagejson, prettier, eslint, test]
name: Post-Build
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 2
outputs:
needsPackage: ${{ steps.checkEligibility.outputs.needsPackage }}
Expand Down Expand Up @@ -128,24 +162,26 @@ jobs:
package:
needs: [postBuild]
name: Package
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 2
outputs:
packageVersion: ${{ steps.outputPackageVersion.outputs.packageVersion }}
if: needs.postBuild.outputs.needsPackage == 'true'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 16.16.0
node-version: 24
- run: npm install -g npm@11.10.0
name: Upgrade npm
- name: Cache Node Modules
id: cache
uses: actions/cache@v3
uses: actions/cache@v5
env:
cache-name: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-24
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
name: Configure Credentials For GitHub Packages
- run: npm ci
Expand Down Expand Up @@ -189,25 +225,25 @@ jobs:
- run: npm pack
working-directory: .
- name: Upload
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v7
with:
name: package
path: "*.tgz"
publish:
name: "Publish to GitHub Packages"
needs: [postBuild, package]
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 2
if: needs.postBuild.outputs.needsPackage == 'true'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
- name: Upload
uses: actions/download-artifact@v2
uses: actions/download-artifact@v8
with:
name: package
- uses: actions/setup-node@v3
- uses: actions/setup-node@v6
with:
node-version: 16.16.0
node-version: 24
registry-url: https://npm.pkg.github.com/
scope: "@mobsuccess-devops"
- run: echo "registry=https://npm.pkg.github.com/@mobsuccess-devops" >> .npmrc
Expand Down
Loading