Skip to content

Commit

Permalink
use a step with output for hasPackageJson and hasBuildCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
circlecube committed Dec 14, 2023
1 parent bf5ed46 commit b073e8d
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/module-plugin-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,37 @@ jobs:
working-directory: ./vendor/${{ inputs.module-repo }}
run: composer install --no-progress --no-dev --optimize-autoloader --prefer-dist

- name: Check Module for package file
id: package
working-directory: ./vendor/${{ inputs.module-repo }}
shell: bash
run: |
echo "hasPackageJson=`test -f vendor/${{ inputs.module-repo }}/package.json` >> $GITHUB_OUTPUT
- name: Check Module for build script
id: build
working-directory: ./vendor/${{ inputs.module-repo }}
if: ${{ steps.workflow.outputs.hasPackageJson }}
shell: bash
run: |
echo "hasBuildCommand=`grep -wq '"build":' vendor/${{ inputs.module-repo }}/package.json"` >> $GITHUB_OUTPUT
- name: Setup Registry for Module
working-directory: ./vendor/${{ inputs.module-repo }}
if: ${{ hashFiles('vendor/${{ inputs.module-repo }}/package.json') != '' }}
if: ${{ steps.package.outputs.hasPackageJson != '' }}
run: printf "\n//npm.pkg.github.com/:_authToken=${{ secrets.NEWFOLD_ACCESS_TOKEN }}" >> .npmrc

- name: NPM Install for Module if package.json exists
working-directory: ./vendor/${{ inputs.module-repo }}
if: ${{ hashFiles('vendor/${{ inputs.module-repo }}/package.json') != '' }}
if: ${{ steps.package.outputs.hasPackageJson != '' }}
run: npm ci --legacy-peer-deps

# - name: Build Module if build command exists
# working-directory: ./vendor/${{ inputs.module-repo }}
# if: |
# ${{ hashFiles('vendor/${{ inputs.module-repo }}/package.json') != '' }} &&
# grep -wq `"build":` vendor/${{ inputs.module-repo }}/package.json
# run: npm run build
- name: Build Module if build command exists
working-directory: ./vendor/${{ inputs.module-repo }}
if: |
${{ steps.package.outputs.hasPackageJson != '' }} &&
${{ steps.build.outputs.hasBuildCommand != '' }}
run: npm run build

# step to sync js package files with build files

Expand Down

0 comments on commit b073e8d

Please sign in to comment.