Workflow to performs continuous integration steps agains a Node.js project:
- CodeQL analysis
- Linting
- Build
- Test
name: Nodejs Continuous Integration
on:
merge_group:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
security-events: write
# FIXME: This is a workaround for having workflow ref. See https://github.com/orgs/community/discussions/38659
id-token: write
jobs:
continuous-integration:
uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@0.13.0| Input | Description | Type | Default | Required |
|---|---|---|---|---|
build |
Build parameters. Must be a string or a json array of strings or object. | string |
build |
false |
checks |
Optional flag to enable check steps. | boolean |
true |
false |
code-ql |
Code QL analysis language. See https://github.com/github/codeql-action. | string |
|
false |
lint |
Optional flag to enable linting. | boolean |
true |
false |
test |
Optional flag to enable test. | boolean |
true |
false |
coverage |
Specifify code coverage reporter. Supported values: codecov. |
string |
|
false |
When build is a json object, the following parameters are supported:
| Input | Description | Type | Default | Required |
|---|---|---|---|---|
commands |
Build command(s). | string[] | ["build"] |
false |
artifact |
Build artifact (name will be build) to be uploaded. (See https://github.com/actions/upload-artifact) |
string or string[] | `` | false |
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@0.13.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 }}