Skip to content

Commit

Permalink
Refactor workflows with various enhancements (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkoops authored Dec 21, 2023
1 parent 780eec9 commit 8edd7c5
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 24 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ indent_style = tab
[*.json]
indent_style = space
indent_size = 2

[*.yml]
indent_style = space
indent_size = 2
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
52 changes: 33 additions & 19 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
Expand All @@ -10,31 +7,48 @@ on:
pull_request:

jobs:
build:
test:
name: Run tests on supported Node.js versions
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: [14.x, 16.x, 17.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
# See supported Node.js versions at https://nodejs.org/en/about/previous-releases
node-version: [18, 20, 21]

steps:
- uses: actions/checkout@main
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@main
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

dtslint:
name: Validate type definitions
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: lts/*
- run: npm ci
- run: npm run dtslint
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Install dependencies
run: npm ci

- name: Validate type definitions
run: npm run dtslint
18 changes: 13 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,25 @@ on:

jobs:
publish:
name: Release
name: Publish package to NPM
runs-on: ubuntu-latest
environment: release

steps:
- uses: actions/checkout@main
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@main

- name: Set up Node.js
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
- run: npm publish
node-version: 20
cache: npm
registry-url: https://registry.npmjs.org

- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 8edd7c5

Please sign in to comment.