69 lines
2.5 KiB
YAML
69 lines
2.5 KiB
YAML
name: Setup WooCommerce Monorepo
|
|
description: Handles the installation, building, and caching of the projects within the monorepo.
|
|
|
|
inputs:
|
|
install-filters:
|
|
description: The PNPM filter used to decide what projects to install. Supports multiline strings for multiple filters.
|
|
default: ""
|
|
build:
|
|
description: Indicates whether or not the action should build any projects.
|
|
default: "true"
|
|
build-filters:
|
|
description: The PNPM filter used to decide what projects to build. Supports multiline strings for multiple filters.
|
|
default: ""
|
|
php-version:
|
|
description: The version of PHP that the action should set up.
|
|
default: "7.2"
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Parse Action Input
|
|
id: parse-input
|
|
shell: bash
|
|
run: |
|
|
echo "::set-output name=INSTALL_FILTERS::$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.install-filters }}')"
|
|
echo "::set-output name=BUILD_FILTERS::$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.build-filters }}')"
|
|
|
|
- name: Setup PNPM
|
|
uses: pnpm/action-setup@10693b3829bf86eb2572aef5f3571dcf5ca9287d
|
|
with:
|
|
version: 7
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93
|
|
with:
|
|
node-version-file: .nvmrc
|
|
cache: pnpm
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@e04e1d97f0c0481c6e1ba40f8a538454fe5d7709
|
|
with:
|
|
php-version: ${{ inputs.php-version }}
|
|
coverage: none
|
|
|
|
- name: Cache Composer Dependencies
|
|
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
|
|
with:
|
|
path: ~/.cache/composer/files
|
|
key: ${{ runner.os }}-php-${{ inputs.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
restore-keys: ${{ runner.os }}-php-${{ inputs.php-version }}-composer-
|
|
|
|
- name: Install Node and PHP Dependencies
|
|
shell: bash
|
|
run: |
|
|
pnpm -w install turbo
|
|
pnpm install ${{ steps.parse-input.outputs.INSTALL_FILTERS }}
|
|
|
|
- name: Cache Build Output
|
|
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
|
|
with:
|
|
path: node_modules/.cache/turbo
|
|
key: ${{ runner.os }}-build-output-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
|
|
restore-keys: ${{ runner.os }}-build-output-
|
|
|
|
- name: Build
|
|
if: ${{ inputs.build == 'true' }}
|
|
shell: bash
|
|
run: pnpm -w exec turbo run turbo:build ${{ steps.parse-input.outputs.BUILD_FILTERS }}
|