diff --git a/.github/actions/composite-cache-deps/action.yaml b/.github/actions/composite-cache-deps/action.yaml index 862666e..724b139 100644 --- a/.github/actions/composite-cache-deps/action.yaml +++ b/.github/actions/composite-cache-deps/action.yaml @@ -10,6 +10,10 @@ inputs: description: The working directory of the application default: . required: false + target-env: + description: '"dev" or "prod". Controls whether dev dependencies are installed' + default: dev + required: false runs: using: composite @@ -26,6 +30,6 @@ runs: key: node-modules-${{ hashFiles(format('{0}/{1}', inputs.working-dir, 'package-lock.json')) }} - name: Install dependencies if: steps.cache.outputs.cache-hit != 'true' - run: npm ci + run: ${{ inputs.target-env == 'dev' && 'npm ci' || 'npm ci --omit=dev' }} shell: bash working-directory: ${{ inputs.working-dir }} diff --git a/.github/workflows/17-1-custom-actions-composite.yaml b/.github/workflows/17-1-custom-actions-composite.yaml index d99e89c..3e64610 100644 --- a/.github/workflows/17-1-custom-actions-composite.yaml +++ b/.github/workflows/17-1-custom-actions-composite.yaml @@ -1,7 +1,15 @@ -name: 17 - Custom Actions - Composite +name: 17 - 1 - Custom Actions - Composite +run-name: 17 - 1 - Custom Actions - Composite | env - ${{ inputs.target-env }} on: workflow_dispatch: + inputs: + target-env: + description: Which environment to target for dependency installation + type: choice + options: + - dev + - prod env: working-directory: 17-custom-actions/react-app @@ -18,6 +26,7 @@ jobs: with: node-version: 20.x working-dir: ${{ env.working-directory }} + target-env: ${{ inputs.target-env }} - name: Test run: npm run test - name: Build