-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WordPress build] Only build the latest patch version of WordPress (#…
…1955) This PR ensures we always build the latest patch version of each minor WordPress version when running the WordPress build. Playground supports only the latest patch version of each minor WordPress release (e.g. 6.6, 6.5). But before this PR, the WordPress build script could include multiple patch versions of WordPress, such as 6.6.2 and 6.6.1. When this happens the latest version would correctly be the latest minor version (6.6) and point to the latest patch (6.6.2), but the minus one minor version would be the older patch of the latest minor version (6.6.1) instead of the previous minor version (6.5). This means that a build script like `npx nx bundle-wordpress:major-and-beta playground-wordpress-builds` would correctly build the latest minor version (6.6) with the code from the latest patch (6.6.2). After that, instead of building the older minor version (6.5) it would rebuild the latest minor version (6.6) with the code from an older patch (6.6.1). As a consequence, our git history would be polluted by commits every time this _Refresh WordPress Major&Beta_ workflow runs. To address this we filter the list of latest versions to include only the latest patch for each minor version. Older patches are excluded from the list. This PR also prevents the _Refresh WordPress Major&Beta_ workflow from committing changes when the build fails. ## Testing Instructions (or ideally a Blueprint) - Run ` npx nx bundle-wordpress:major-and-beta playground-wordpress-builds` and confirm there were no changes
- Loading branch information
Showing
2 changed files
with
57 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,8 @@ on: | |
- cron: '*/20 * * * *' | ||
|
||
jobs: | ||
build_and_deploy: | ||
# Only run this workflow from the trunk branch and when it's triggered by dmsnell OR adamziel | ||
build_wordpress_major_and_beta_push_to_github_and_deploy_website: | ||
# Only run this workflow from the trunk branch and when it's triggered by a maintainer listed below | ||
if: > | ||
github.ref == 'refs/heads/trunk' && ( | ||
github.actor == 'adamziel' || | ||
|
@@ -39,6 +39,7 @@ jobs: | |
curl -fsSL https://bun.sh/install | bash | ||
- uses: ./.github/actions/prepare-playground | ||
- name: 'Recompile WordPress' | ||
id: build | ||
shell: bash | ||
env: | ||
FORCE_REBUILD: ${{ github.event.inputs.force_rebuild }} | ||
|
@@ -48,13 +49,13 @@ jobs: | |
run: | | ||
if [ -z "$(git status --porcelain)" ]; then | ||
echo "No changes" | ||
echo 'CHANGES=0' >> $GITHUB_OUTPUT | ||
echo 'COMMIT_CHANGES=0' >> $GITHUB_OUTPUT | ||
else | ||
echo "Changes detected" | ||
echo 'CHANGES=1' >> $GITHUB_OUTPUT | ||
echo 'COMMIT_CHANGES=1' >> $GITHUB_OUTPUT | ||
fi | ||
- name: Push rebuilt WordPress to GitHub | ||
if: steps.changes.outputs.CHANGES == '1' | ||
if: steps.changes.outputs.COMMIT_CHANGES == '1' | ||
run: | | ||
git config --global user.name "deployment_bot" | ||
git config --global user.email "[email protected]" | ||
|
@@ -67,7 +68,7 @@ jobs: | |
git push origin HEAD:trunk | ||
fi; | ||
- name: Deploy website | ||
if: steps.changes.outputs.CHANGES == '1' | ||
if: steps.changes.outputs.COMMIT_CHANGES == '1' | ||
uses: benc-uk/workflow-dispatch@v1 | ||
with: | ||
workflow: build-website.yml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters