nanoexpress/nanoexpress

View on GitHub
.github/workflows/lint_test_release.yml

Summary

Maintainability
Test Coverage
# 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: Linting, Testing and Release

on:
  push:
    branches: [master]

env:
  CI: true

jobs:
  lint:
    runs-on: ubuntu-22.04

    steps:
      - uses: actions/checkout@v4

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

      - name: Install
        run: npm ci

      - name: Lint code
        run: npm run lint
  test:
    needs: lint
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        node-version: [18]
        os: [ubuntu-22.04, macos-13]

    steps:
      - uses: actions/checkout@v4

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

      - name: Install
        run: npm ci

      - name: Test code
        run: npm run test
  release:
    needs: test
    runs-on: ubuntu-22.04

    steps:
      - uses: actions/checkout@v4

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

      - name: Install
        run: npm ci

      - name: Build
        run: npm run build

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