-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate with wp-product-info for plugin updates (#179)
* test: confirm update callbacks are attached * chore: Add updater functions * chore: Add updater callbacks * chore: add convenience constants used by updater functionality * chore: load updater files via require_once * chore: exclude VIP rule for wp_remote_get calls * chore: coding standards * chore: add base CircleCI config. Copied initial setup from the Atlas Headless Extension plugin. * chore: Remove unused CircleCI config parts * chore: fix test that checks for active plugin count. Our integration with the plugin update mechanism outputs a "active" row to display errors when communicating with wp-product-info. This class is used by WP to style the update notices to match the table row. * chore: Add blakewilson/wp-enforce-semver dependency * chore: Instantiate EnforceSemVer class * chore: Change support link to GitHub issues * ci: download latest release zip * ci: adjust unzip command * ci: adjust unzip paths * ci: adjust paths * ci: mkdir build * ci: update persist path. Add temp debug info. * ci: move zip to build dir for later deployment * ci: add build version to zip file name when moving to build directory * chore: Customize semver notice text. Removes link to semver.org. * test: confirm callback to customize semver notice text is attached. * chore: add changeset * ci: update CircleCI config to run deploy jobs on tags
- Loading branch information
Showing
11 changed files
with
640 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@wpengine/wp-graphql-content-blocks": minor | ||
--- | ||
|
||
Added support for automatic updates hosted from WP Engine infrastructure. Includes warnings when major versions with potential breaking changes are released. |
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 |
---|---|---|
@@ -0,0 +1,163 @@ | ||
# Notes: | ||
# - Jobs initially start from /home/circleci/project | ||
# - Plugin located at /home/circleci/project/wp-graphql-content-blocks | ||
|
||
version: 2.1 | ||
|
||
orbs: | ||
php: circleci/[email protected] | ||
wp-product-orb: wpengine/[email protected] | ||
node: circleci/[email protected] | ||
|
||
jobs: | ||
plugin-unzip: | ||
executor: wp-product-orb/default | ||
environment: | ||
WPE_SESSION_DIR: ./.wpe | ||
parameters: | ||
slug: | ||
type: string | ||
filename: | ||
type: string | ||
steps: | ||
- attach_workspace: | ||
at: . | ||
- wp-product-orb/variable_load | ||
- run: | ||
name: "Unzip plugin files" | ||
command: | | ||
cd ~/project | ||
mkdir build | ||
curl -sL https://github.com/wpengine/wp-graphql-content-blocks/releases/latest/download/wp-graphql-content-blocks.zip > <<parameters.slug>>.zip | ||
unzip -o -d <<parameters.slug>> <<parameters.slug>>.zip | ||
ls -laR | ||
- wp-product-orb/get_version_from_php: | ||
filename: <<parameters.slug>>/<<parameters.filename>> | ||
return_var: BUILD_VERSION | ||
- wp-product-orb/variable: | ||
var: BUILD_VERSION | ||
value: $BUILD_VERSION | ||
- run: | ||
name: "Move zip file to build directory" | ||
command: | | ||
mv <<parameters.slug>>.zip build/<<parameters.slug>>.$BUILD_VERSION.zip | ||
- run: | ||
name: "DEBUG" | ||
command: | | ||
ls -laR | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- . | ||
|
||
plugin-build-json: | ||
executor: wp-product-orb/parser | ||
environment: | ||
WPE_SESSION_DIR: ./.wpe | ||
parameters: | ||
slug: | ||
type: string | ||
steps: | ||
- attach_workspace: | ||
at: . | ||
- run: | ||
command: | | ||
cd ~/project | ||
- wp-product-orb/variable_load | ||
- wp-product-orb/parse_wp_readme: | ||
infile: <<parameters.slug>>/readme.txt | ||
outfile: build/<<parameters.slug>>.$BUILD_VERSION.json | ||
- store_artifacts: | ||
path: build | ||
- run: | ||
name: "DEBUG" | ||
command: | | ||
pwd | ||
ls -laR | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- build | ||
|
||
plugin-deploy: | ||
executor: wp-product-orb/authenticate | ||
environment: | ||
WPE_SESSION_DIR: ./.wpe | ||
parameters: | ||
auth_url: | ||
type: string | ||
upload_url: | ||
type: string | ||
slug: | ||
type: string | ||
steps: | ||
- attach_workspace: | ||
at: . | ||
- wp-product-orb/variable_load | ||
- wp-product-orb/authenticate: | ||
user: WPE_LDAP_USER | ||
pass: WPE_LDAP_PASS | ||
url: <<parameters.auth_url>> | ||
- run: | ||
name: "DEBUG" | ||
command: | | ||
pwd | ||
ls -laR | ||
- wp-product-orb/post_zip: | ||
url: <<parameters.upload_url>>/<<parameters.slug>> | ||
zip: build/<<parameters.slug>>.$BUILD_VERSION.zip | ||
json: build/<<parameters.slug>>.$BUILD_VERSION.json | ||
version: $BUILD_VERSION | ||
|
||
workflows: | ||
deploy: | ||
jobs: | ||
- plugin-unzip: | ||
slug: wpgraphql-content-blocks | ||
filename: wp-graphql-content-blocks.php | ||
# Run this job when a tag is published. | ||
filters: | ||
branches: | ||
ignore: /.*/ | ||
tags: | ||
only: /^v.*/ | ||
- plugin-build-json: | ||
slug: wpgraphql-content-blocks | ||
requires: | ||
- plugin-unzip | ||
# Run this job when a tag is published. | ||
filters: | ||
branches: | ||
ignore: /.*/ | ||
tags: | ||
only: /^v.*/ | ||
- plugin-deploy: | ||
name: "plugin-deploy-staging" | ||
slug: wpgraphql-content-blocks | ||
requires: | ||
- plugin-unzip | ||
- plugin-build-json | ||
filters: | ||
branches: | ||
only: | ||
- main | ||
- canary | ||
tags: | ||
only: /^v.*/ | ||
context: wpe-ldap-creds | ||
auth_url: https://auth-staging.wpengine.io/v1/tokens | ||
upload_url: https://wp-product-info-staging.wpesvc.net/v1/plugins | ||
- plugin-deploy: | ||
name: "plugin-deploy-production" | ||
slug: wp-graphql-content-blocks | ||
requires: | ||
- "plugin-deploy-staging" | ||
filters: | ||
branches: | ||
ignore: /.*/ | ||
tags: | ||
# Run this job when a tag is published. | ||
only: /^v.*/ | ||
context: wpe-ldap-creds | ||
auth_url: https://auth.wpengine.io/v1/tokens | ||
upload_url: https://wp-product-info.wpesvc.net/v1/plugins |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.