Skip to content

Commit

Permalink
Merge pull request #29 from PrivateAIM/feature/28-update-actions-to-s…
Browse files Browse the repository at this point in the history
…upport-nodejs-20

Feature: update actions to support nodejs 20
  • Loading branch information
DiCanio authored Feb 28, 2024
2 parents 0d6aa24 + f7136af commit b10f665
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 92 deletions.
32 changes: 16 additions & 16 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: 'Build'
description: 'Prepares the repo for a job by running the build'
name: "Build"
description: "Prepares the repo for a job by running the build"

runs:
using: 'composite'
using: "composite"
steps:
- name: Use cache
id: 'cache'
uses: actions/cache@v3
with:
path: |
**/dist/**
**/bin/**
key: ${{ runner.os }}-build-${{ github.sha }}
- name: Use cache
id: "cache"
uses: actions/cache@v4
with:
path: |
**/dist/**
**/bin/**
key: ${{ runner.os }}-build-${{ github.sha }}

- name: Build
shell: bash
if: steps.cache.outputs.cache-hit != 'true'
run: |
npm run build
- name: Build
shell: bash
if: steps.cache.outputs.cache-hit != 'true'
run: |
npm run build
52 changes: 26 additions & 26 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
name: 'Install'
description: 'Prepares the repo for a job by checking out and installing dependencies'
name: "Install"
description: "Prepares the repo for a job by checking out and installing dependencies"
inputs:
node-version:
description: 'The node version to setup'
description: "The node version to setup"
required: true
registry-url:
description: 'Define registry-url'
description: "Define registry-url"
required: false

runs:
using: 'composite'
using: "composite"
steps:
- name: echo github.ref
shell: bash
run: echo ${{ github.ref }}
- name: echo github.ref
shell: bash
run: echo ${{ github.ref }}

- name: Use Node.js ${{ inputs.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
registry-url: ${{ inputs.registry-url }}
- name: Use Node.js ${{ inputs.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
registry-url: ${{ inputs.registry-url }}

- name: Use cache
uses: actions/cache@v3
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-install-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-install-
- name: Use cache
uses: actions/cache@v4
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-install-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-install-
- name: Install
shell: bash
run: |
npm ci
- name: Install
shell: bash
run: |
npm ci
94 changes: 47 additions & 47 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:
pull-requests: write

env:
PRIMARY_NODE_VERSION: 18
PRIMARY_NODE_VERSION: 20

jobs:
install:
Expand All @@ -32,20 +32,20 @@ jobs:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Install
uses: ./.github/actions/install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
- name: Install
uses: ./.github/actions/install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}

- name: Build
uses: ./.github/actions/build
- name: Build
uses: ./.github/actions/build

- name: Lint
run: |
npm run lint
- name: Lint
run: |
npm run lint
build:
name: Build
Expand All @@ -66,64 +66,64 @@ jobs:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Install
uses: ./.github/actions/install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
- name: Install
uses: ./.github/actions/install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}

- name: Build
uses: ./.github/actions/build
- name: Build
uses: ./.github/actions/build

- name: Run tests
run: |
npm run test
- name: Run tests
run: |
npm run test
release:
name: Release
needs: [lint, tests]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Install
uses: ./.github/actions/install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
- name: Install
uses: ./.github/actions/install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}

- name: Build
uses: ./.github/actions/build
- name: Build
uses: ./.github/actions/build

#- name: Release
#env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
#
# run: npx semantic-release
#env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
#
# run: npx semantic-release

coverage:
name: Coverage
needs: [release]
runs-on: ubuntu-latest
if: ${{ github.ref_name == 'master' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Install
uses: ./.github/actions/install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
- name: Install
uses: ./.github/actions/install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}

- name: Build
uses: ./.github/actions/build
- name: Build
uses: ./.github/actions/build

- name: Coverage
run: |
npm run test:coverage
- name: Coverage
run: |
npm run test:coverage
#- name: Upload report
# uses: codecov/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"dist"
],
"engines": {
"node": ">=18.0.0"
"node": ">=20.0.0"
},
"scripts": {
"build:types": "tsc --emitDeclarationOnly",
Expand Down Expand Up @@ -89,4 +89,4 @@
".js": "npm run lint:fix",
"*.ts": "npm run lint:fix"
}
}
}

0 comments on commit b10f665

Please sign in to comment.