Skip to content

Commit f627fea

Browse files
committed
Merge branch 'trunk' into multilingual-support
2 parents fe191ab + c70bcb8 commit f627fea

File tree

167 files changed

+14913
-13788
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+14913
-13788
lines changed

.github/scripts/set-version-bump.js

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,48 @@ const fs = require( 'fs' );
22
const path = require( 'path' );
33
const semver = require( 'semver' );
44
const packagefile = path.resolve( __dirname, '../../package.json' );
5-
const pluginfile = path.resolve( __dirname, '../../bootstrap.php' );
5+
const pluginfile = path.resolve(
6+
__dirname,
7+
'../../bootstrap.php'
8+
);
69

710
if ( fs.existsSync( packagefile ) && fs.existsSync( pluginfile ) ) {
8-
const packageData = require( packagefile );
9-
const currentVersion = packageData.version;
10-
let type = process.argv[ 2 ];
11-
if ( ! [ 'major', 'minor', 'patch' ].includes( type ) ) {
12-
type = 'patch';
13-
}
11+
const packageData = require( packagefile );
12+
const currentVersion = packageData.version;
13+
let type = process.argv[ 2 ];
14+
if ( ! [ 'major', 'minor', 'patch' ].includes( type ) ) {
15+
type = 'patch';
16+
}
1417

15-
const newVersion = semver.inc( packageData.version, type );
16-
packageData.version = newVersion;
17-
fs.writeFileSync( packagefile, JSON.stringify( packageData, null, 4 ) );
18+
const newVersion = semver.inc( packageData.version, type );
19+
packageData.version = newVersion;
1820

19-
fs.readFile( pluginfile, 'utf8', function ( err, data ) {
20-
if ( err ) {
21-
return console.log( err );
22-
}
23-
const result = data.replaceAll( currentVersion, newVersion );
21+
// update version in package file
22+
fs.writeFileSync( packagefile, JSON.stringify( packageData, null, 2 ) );
2423

25-
fs.writeFile( pluginfile, result, 'utf8', function ( err ) {
26-
if ( err ) {
27-
return console.log( err );
28-
}
29-
} );
30-
} );
24+
fs.readFile( pluginfile, 'utf8', function ( err, data ) {
25+
if ( err ) {
26+
return console.log( err );
27+
}
28+
const result = data.replaceAll( currentVersion, newVersion );
3129

32-
console.log( 'Version updated', currentVersion, '=>', newVersion );
30+
// update version in php file
31+
fs.writeFile( pluginfile, result, 'utf8', function ( err ) {
32+
if ( err ) {
33+
return console.log( err );
34+
}
35+
} );
36+
} );
37+
38+
const output = {
39+
oldVersion: currentVersion,
40+
newVersion: newVersion,
41+
level: type,
42+
message: `Version updated from ${ currentVersion } to ${ newVersion }`,
43+
}
44+
console.log( JSON.stringify( output ) );
45+
} else {
46+
console.log( JSON.stringify( {
47+
message: 'Version update error. A file was not found.',
48+
} ) );
3349
}

.github/workflows/brand-plugin-test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ jobs:
2929
needs: setup
3030
uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main
3131
with:
32-
only-module-tests: true
3332
module-repo: ${{ github.repository }}
3433
module-branch: ${{ needs.setup.outputs.branch }}
3534
plugin-repo: "newfold-labs/wp-plugin-bluehost"
@@ -40,7 +39,6 @@ jobs:
4039
needs: setup
4140
uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main
4241
with:
43-
only-module-tests: true
4442
module-repo: ${{ github.repository }}
4543
module-branch: ${{ needs.setup.outputs.branch }}
4644
plugin-repo: "newfold-labs/wp-plugin-hostgator"
@@ -51,7 +49,6 @@ jobs:
5149
needs: setup
5250
uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main
5351
with:
54-
only-module-tests: true
5552
module-repo: ${{ github.repository }}
5653
module-branch: ${{ needs.setup.outputs.branch }}
5754
plugin-repo: "newfold-labs/wp-plugin-crazy-domains"

.github/workflows/lint-check-spa.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,9 @@ jobs:
3939
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
4040
restore-keys: ${{ runner.os }}-node-
4141

42-
- name: Setup Registry
43-
run: printf "@newfold-labs:registry=https://npm.pkg.github.com/\n//npm.pkg.github.com/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
44-
if: steps.cache.outputs.cache-hit != 'true'
45-
4642
# Installs @wordpress/scripts for lint checks if it does not exist in the cache.
4743
- name: Install dependencies
48-
run: npm i @wordpress/[email protected] @newfold-labs/js-utility-ui-analytics --legacy-peer-deps
44+
run: npm i @wordpress/[email protected] --legacy-peer-deps
4945
if: steps.cache.outputs.cache-hit != 'true'
5046

5147
# Gets the files changed wrt to trunk and filters out the js files.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Newfold Prepare Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
level:
7+
description: The level of release to be used.
8+
type: choice
9+
options:
10+
- patch
11+
- minor
12+
- major
13+
default: 'patch'
14+
required: true
15+
16+
jobs:
17+
18+
# This job is used to extract the branch name from the pull request or branch.
19+
setup:
20+
name: Setup
21+
runs-on: ubuntu-latest
22+
outputs:
23+
branch: ${{ steps.extract_branch.outputs.branch }}
24+
steps:
25+
- name: Extract branch name
26+
shell: bash
27+
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
28+
id: extract_branch
29+
30+
# This job runs the newfold module-prep-release workflow for this module.
31+
prep-release:
32+
name: Prepare Release
33+
needs: setup
34+
uses: newfold-labs/workflows/.github/workflows/module-prep-release.yml@add/preprelease
35+
with:
36+
module-repo: ${{ github.repository }}
37+
module-branch: ${{ needs.setup.outputs.branch }}
38+
level: ${{ inputs.level }}
39+
secrets: inherit

.github/workflows/prep-release.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Prepare Release
2+
# This workflow is manually dispatched. It:
3+
# - bumps the version as specified in the input
4+
# - prepares build artifacts
5+
# - creates a release branch
6+
# - commits the changes
7+
# - creates a pull request to the main branch
8+
# - TODO: consider skipping the PR, push to main, and create a release automatically
9+
10+
on:
11+
workflow_dispatch:
12+
inputs:
13+
level:
14+
description: The level of release to be used.
15+
type: choice
16+
options:
17+
- patch
18+
- minor
19+
- major
20+
default: 'patch'
21+
required: true
22+
23+
jobs:
24+
prep-release:
25+
name: Prepare Release
26+
runs-on: ubuntu-latest
27+
permissions:
28+
# Give the default token permission to commit, push the changed files, and open a pull request.
29+
contents: write
30+
pull-requests: write
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
34+
35+
- name: Setup PHP
36+
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2.33.0
37+
with:
38+
php-version: '8.1'
39+
coverage: none
40+
tools: composer, cs2pr
41+
42+
- name: Setup Node.js
43+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
44+
with:
45+
node-version: 20.x
46+
cache: 'npm'
47+
48+
- name: Get Composer cache directory
49+
id: composer-cache
50+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
51+
52+
- name: Cache Composer vendor directory
53+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
54+
with:
55+
path: ${{ steps.composer-cache.outputs.dir }}
56+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
57+
restore-keys: |
58+
${{ runner.os }}-composer-
59+
60+
- name: Show versions
61+
run: |
62+
php --version
63+
composer --version
64+
node --version
65+
npm --version
66+
67+
- name: Validate composer.json and composer.lock
68+
run: composer validate
69+
70+
- name: Install Packages
71+
run: npm install
72+
73+
- name: Run Update Version Script
74+
id: version_bump
75+
run: |
76+
echo "Running version bump script..."
77+
OUTPUT=$(node ./.github/scripts/set-version-bump.js ${{ inputs.level }})
78+
echo ""
79+
echo "====== Script Output ======"
80+
echo "$OUTPUT"
81+
echo "==========================="
82+
echo ""
83+
echo "new_version=$(echo "$OUTPUT" | jq -r '.newVersion')" >> $GITHUB_OUTPUT
84+
echo "old_version=$(echo "$OUTPUT" | jq -r '.oldVersion')" >> $GITHUB_OUTPUT
85+
echo "message=$(echo "$OUTPUT" | jq -r '.message')" >> $GITHUB_OUTPUT
86+
87+
- name: Run Build and Update Language Files
88+
run: npm run post-set-version
89+
90+
- name: Create Release Pull Request
91+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
92+
with:
93+
token: ${{ github.token }}
94+
base: trunk
95+
branch: release/${{ steps.version_bump.outputs.new_version }}
96+
title: "Automated ${{ inputs.level }} Release ${{ steps.version_bump.outputs.new_version }} PR"
97+
body: "This PR was created automatically by a GitHub Action."
98+
commit-message: "🤖 prep release - ${{ steps.version_bump.outputs.message }}"

bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function nfd_wp_module_onboarding_register() {
2424

2525
// Set Global Constants
2626
if ( ! defined( 'NFD_ONBOARDING_VERSION' ) ) {
27-
define( 'NFD_ONBOARDING_VERSION', '2.6.8' );
27+
define( 'NFD_ONBOARDING_VERSION', '2.7.0' );
2828
}
2929
if ( ! defined( 'NFD_ONBOARDING_DIR' ) ) {
3030
define( 'NFD_ONBOARDING_DIR', __DIR__ );

build/2.6.8/100.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/2.6.8/127.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/2.6.8/202.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/2.6.8/206.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)