Skip to content

Release/4.2.3

Release/4.2.3 #9

Workflow file for this run

name: Test
on:
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it.
- name: Checkout Repo
id: checkout_repo
uses: actions/checkout@v4
# Gets the name from package.json and sets it as an environment variable.
- name: Set Theme Name
id: set_theme_name
run: echo "THEME_NAME=$(jq -r '.name' package/package.json)" >> $GITHUB_ENV
# Gets the version from package.json and sets it as an environment variable.
- name: Set Theme Version
id: set_theme_version
run: echo "THEME_VERSION=$(jq -r '.version' package/package.json)" >> $GITHUB_ENV
# Gets the PHP version from composer.json and sets it as an environment variable,
# by parsing the semver string to a setup-php string.
- name: Set PHP Version
id: set_php_version
run: |
RAW_PHP_VERSION=$(jq -r '.require.php' package/composer.json)
MAJOR_VERSION_PATTERN="^\^"
if [[ $RAW_PHP_VERSION =~ $MAJOR_VERSION_PATTERN ]]; then
PARSED_PHP_VERSION=$(echo $RAW_PHP_VERSION | grep -oE '[0-9]+' | head -n 1)
else
PARSED_PHP_VERSION=$(echo $RAW_PHP_VERSION | grep -oE '[0-9]+(\.[0-9]+)?' | head -n 1)
fi
echo "PHP_VERSION=$PARSED_PHP_VERSION" >> $GITHUB_ENV
# Gets the Node version from .nvmrc and sets it as an environment variable.
- name: Set Node Version
id: set_node_version
run: echo "NODE_VERSION=$(cat package/.nvmrc)" >> $GITHUB_ENV
# Setup PHP.
- name: Setup PHP
id: setup_php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
# Setup Node.
- name: Setup Node
id: setup_node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
# Installs npm and composer dependencies. Note that we use `npm install`
# instead of `npm ci` because we do not yet have a lock file.
- name: Install
id: install
working-directory: package
run: npm install
# Lint all files.
- name: Lint
id: lint
working-directory: package
run: npm run lint
# Runs a build.
- name: Build
id: build
working-directory: package
run: npm run build