Skip to content

chore(ci): Back to descriptive matrix job name #239

chore(ci): Back to descriptive matrix job name

chore(ci): Back to descriptive matrix job name #239

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- v*.*.*
pull_request:
branches:
- main
workflow_dispatch:
jobs:
job_lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout, Setup Node.js v${{ env.NODE_VERSION }} and Install dependencies
uses: manferlo81/action-checkout-node-install@v0
with:
node-version: ${{ env.NODE_VERSION }}
env:
NODE_VERSION: 20.x
- name: Lint code
run: npm run lint
job_test_and_build:
strategy:
matrix:
os:
- name: Window
machine: windows-latest
- name: Ubuntu
machine: ubuntu-latest
- name: macOS
machine: macos-latest
node-version:
- 18.x
- 20.x
- 21.x
- 22.x
name: Test and Build, ${{ matrix.os.name }}, NodeJS v${{ matrix.node-version }}
runs-on: ${{ matrix.os.machine }}
needs: job_lint
steps:
- name: Checkout, Setup Node.js v${{ matrix.node-version }} and Install dependencies
uses: manferlo81/action-checkout-node-install@v0
with:
node-version: ${{ matrix.node-version }}
- name: Run tests
run: npm test
env:
COVERAGE: SKIP
- name: Build
run: npm run build
job_upload_coverage:
name: Upload Coverage to Codecov
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref_type == 'branch'
needs: job_test_and_build
steps:
- name: Checkout, Setup Node.js v${{ env.NODE_VERSION }} and Install dependencies
uses: manferlo81/action-checkout-node-install@v0
with:
node-version: ${{ env.NODE_VERSION }}
env:
NODE_VERSION: 20.x
- name: Run tests
run: npm test
env:
COVERAGE: CI
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
directory: coverage
token: ${{ secrets.CODECOV_TOKEN }}
job_create_release:
name: Create GitHub Release
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
needs: job_test_and_build
permissions:
contents: write
steps:
- name: Checkout, Setup Node.js v${{ env.NODE_VERSION }} and Install dependencies
uses: manferlo81/action-checkout-node-install@v0
with:
node-version: ${{ env.NODE_VERSION }}
env:
NODE_VERSION: 20.x
- name: Build
run: npm run build
- name: Create tarball
run: npm pack
- name: Create Release
uses: manferlo81/action-auto-release@v0
with:
files: selective-option-*.tgz
job_publish_to_npm:
name: Publish Package to npm Registry
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
needs: job_test_and_build
steps:
- name: Checkout, Setup Node.js v${{ env.NODE_VERSION }} and Install dependencies
uses: manferlo81/action-checkout-node-install@v0
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org/
env:
NODE_VERSION: 20.x
- name: Build
run: npm run build
- name: Publish package
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}