Skip to content

Latest commit

 

History

History
204 lines (144 loc) · 6.06 KB

File metadata and controls

204 lines (144 loc) · 6.06 KB

GitHub Reusable Workflow: Node.js Continuous Integration

Node.js Continuous Integration

Release License Stars PRs Welcome

Overview

Workflow to performs continuous integration steps agains a Node.js project:

  • CodeQL analysis
  • Linting
  • Build
  • Test

Permissions

  • contents: read
  • security-events: write
  • id-token: write

Usage

name: Node.js Continuous Integration
on:
  push:
    branches:
      - main
permissions:
  contents: read
  security-events: write
  id-token: write
jobs:
  continuous-integration:
    uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@6809332ced7647b3d52300a47d65657283f3395e # 0.16.0
    with:
      # Build parameters. Must be a string or a JSON object.
      # Default: `build`
      build: build

      # Optional flag to enable check steps.
      # Default: `true`
      checks: true

      # Optional flag to enable linting.
      # Default: `true`
      lint: true

      # Code QL analysis language. See <https://github.com/github/codeql-action>.
      # Default: `typescript`
      code-ql: typescript

      # Enable dependency review scan. See <https://github.com/actions/dependency-review-action>.
      # Default: `true`
      dependency-review: true

      # Optional flag to enable test.
      # Default: `true`
      test: true

      # Specifify code coverage reporter. Supported values: `codecov`.
      # Default: `codecov`
      coverage: codecov

      # Working directory where the dependencies are installed.
      # Default: `.`
      working-directory: .

Inputs

Workflow Call Inputs

Input Description Required Type Default
build Build parameters. Must be a string or a JSON object. false string build
checks Optional flag to enable check steps. false boolean true
lint Optional flag to enable linting. false boolean true
code-ql Code QL analysis language. See https://github.com/github/codeql-action. false string typescript
dependency-review Enable dependency review scan. See https://github.com/actions/dependency-review-action. false boolean true
test Optional flag to enable test. false boolean true
coverage Specifify code coverage reporter. Supported values: codecov. false string codecov
working-directory Working directory where the dependencies are installed. false string .

Examples

Continuous Integration, build and publish

name: Continuous Integration - Build and Publish

name: Nodejs Continuous Integration

on:
  push:
    branches: [main]

jobs:
  continuous-integration:
    uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@6809332ced7647b3d52300a47d65657283f3395e # 0.16.0
    permissions:
      id-token: write
      security-events: write
      contents: read
    with:
      build: |
        {
          "commands": ["build"],
          "artifact": "dist"
        }

  publish:
    needs: continuous-integration
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4.2.2

      - name: Setup NodeJS
        uses: hoverkraft-tech/ci-github-nodejs/actions/setup-node@0.2.2

      - name: Download build artifact
        uses: actions/download-artifact@v2
        with:
          name: build
          path: /

      - name: Publish
        run: |
          npm publish dist
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Contributing

Contributions are welcome! Please see the contributing guidelines for more details.

License

This project is licensed under the MIT License.

SPDX-License-Identifier: MIT

Copyright © 2025 hoverkraft-tech

For more details, see the license.


This documentation was automatically generated by CI Dokumentor.