54 lines
1.2 KiB
YAML
54 lines
1.2 KiB
YAML
name: Verify package.json version
|
|
description: This action build a nodejs app, and run the tests
|
|
|
|
inputs:
|
|
test_action:
|
|
description: Name of the test script
|
|
default: test
|
|
required: false
|
|
|
|
build_action:
|
|
description: Name of the build script
|
|
default: build
|
|
required: false
|
|
|
|
build_path:
|
|
description: Path of the build output
|
|
default: dist
|
|
required: false
|
|
|
|
artifact_name:
|
|
description: Name for the generated artifact
|
|
default: dist
|
|
required: false
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Install dependencies
|
|
shell: sh
|
|
run: apk add nodejs
|
|
|
|
- name: Git Clone
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Restore Node Modules Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-nodejs-${{ hashFiles('package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-nodejs-
|
|
|
|
- name: Build and Test
|
|
shell: sh
|
|
run: |
|
|
npm install
|
|
npm run ${{ inputs.test_action }}
|
|
npm run ${{ inputs.build_action }}
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
name: Upload Artifact
|
|
with:
|
|
name: ${{ inputs.artifact_name }}
|
|
path: ${{ inputs.build_path }}
|