feat: build-node-app
This commit is contained in:
parent
6640f4aaf2
commit
ab4e6935af
1 changed files with 54 additions and 0 deletions
54
.forgejo/actions/build-node-app/action.yaml
Normal file
54
.forgejo/actions/build-node-app/action.yaml
Normal file
|
@ -0,0 +1,54 @@
|
|||
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 }}
|
Loading…
Add table
Add a link
Reference in a new issue