Skip to content

Commit

Permalink
Merge pull request #69 from dreamsicle-io/release/4.2.2-RC10
Browse files Browse the repository at this point in the history
Release/4.2.2 rc10
  • Loading branch information
theenoahmason authored Jun 5, 2024
2 parents 82d3971 + cf755d7 commit 0062cbd
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 28 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
name: Release

on:
workflow_run:
workflows: [test]
types:
- completed
push:
branches:
- master

jobs:
release:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'master' }}
runs-on: ubuntu-latest
steps:

Expand Down
37 changes: 20 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Test

on:
push:
branches: [master]
pull_request:
branches:
- master

jobs:
test:
Expand All @@ -14,30 +15,34 @@ jobs:
id: checkout_repo
uses: actions/checkout@v4

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it.
- name: Enter Theme Directory
id: enter_theme_directory
run: cd package

# 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.json)" >> $GITHUB_ENV
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.json)" >> $GITHUB_ENV
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.
# 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: echo "PHP_VERSION=$(jq -r '.require.php' composer.json)" >> $GITHUB_ENV
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 .nvmrc)" >> $GITHUB_ENV
run: echo "NODE_VERSION=$(cat package/.nvmrc)" >> $GITHUB_ENV

# Setup PHP.
- name: Setup PHP
Expand All @@ -57,19 +62,17 @@ jobs:
# 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

# Return to root.
- name: Return to Root Directory
id: return_to_root_directory
run: cd ..
16 changes: 13 additions & 3 deletions package/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Release

on:
push:
branches: [main]
branches:
- main

jobs:
release:
Expand All @@ -23,10 +24,19 @@ jobs:
id: set_theme_version
run: echo "THEME_VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV

# Gets the PHP version from composer.json and sets it as an environment variable.
# 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: echo "PHP_VERSION=$(jq -r '.require.php' composer.json)" >> $GITHUB_ENV
run: |
RAW_PHP_VERSION=$(jq -r '.require.php' 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
Expand Down
4 changes: 2 additions & 2 deletions package/composer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"require": {
"php": "^8"
"php": "~8.3.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "~3.7.0",
"dealerdirect/phpcodesniffer-composer-installer": "~0.7.2",
"wp-coding-standards/wpcs": "~2.3.0",
"wp-cli/i18n-command": "~2.6"
"wp-cli/i18n-command": "~2.6.0"
},
"config": {
"allow-plugins": {
Expand Down
7 changes: 6 additions & 1 deletion package/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ class ThemePackageBuilderPlugin {
apply(compiler) {
compiler.hooks.afterCompile.tap(this.pluginName, (compilation) => {
// Watch PHP files by adding them to the fileDependencies.
const phpFiles = glob.sync('./**/*.php', { ignore: this.phpIgnore }).map(relPath => path.join(this.themePath, relPath));
const phpFiles = glob.sync('**/*.php', {
cwd: this.themePath,
ignore: this.phpIgnore,
absolute: true,
});
// Resolve all relative paths.
compilation.fileDependencies.addAll(phpFiles);
});
// On watch.
Expand Down

0 comments on commit 0062cbd

Please sign in to comment.