actions/.github/workflows/node.yaml

56 lines
1.6 KiB
YAML
Raw Normal View History

2023-11-24 11:55:39 -05:00
name: Install Dependencies & Build NPM Project
on:
workflow_call:
inputs:
repository:
type: string
required: true
description: Git repository URL
path:
type: string
required: false
description: Path to NPM project root
2023-11-24 12:04:12 -05:00
default: ${{github.workspace}}
2023-11-24 12:10:48 -05:00
artifacts:
type: string
required: false
description: Path to any artifacts you wish uploaded
2023-11-29 09:40:41 -05:00
default: false
2023-11-24 12:48:54 -05:00
artifact_name:
type: string
required: false
description: Path to any artifacts you wish uploaded
default: ${{inputs.artifacts}}
2023-11-24 11:55:39 -05:00
jobs:
docker:
name: Install Dependencies & Build NPM Project
runs-on: ubuntu-latest
container: node
steps:
- name: Clone Repository
uses: ztimson/actions/clone@develop
with:
url: ${{inputs.repository}}
- name: Install Dependencies
run: npm i
working-directory: ${{inputs.path}}
- name: Install Dependencies
run: npm run build:prod || npm run build
working-directory: ${{inputs.path}}
2023-11-29 09:48:44 -05:00
2023-11-24 12:54:50 -05:00
- name: Artifact Name
2023-11-29 09:49:48 -05:00
if: ${{inputs.artifacts}} != "false"
2023-11-24 12:54:50 -05:00
run: echo "ARTIFACTS=$(echo ${{inputs.artifact_name}} | sed s%/%_% )" >> $GITHUB_ENV
2023-11-24 12:10:48 -05:00
- name: Upload Artifacts
2023-11-29 09:49:48 -05:00
if: ${{inputs.artifacts}} != "false"
2023-11-24 12:10:48 -05:00
uses: actions/upload-artifact@v3
with:
2023-11-24 12:54:50 -05:00
name: ${{env.ARTIFACTS}}
2023-11-24 12:48:54 -05:00
path: ${{inputs.artifacts}}
2023-11-29 09:48:24 -05:00
retention-days: 7