Custom GitHub actions that help to composite GitHub workflows across the repos maintained by the Grow Team.
automerge-released-trunk
- Mergetrunk
todevelop
after an extension releasebranch-label
- Set PR labels according to the branch namecoverage-report
- Add a clover coverage report as a PR commenteslint-annotation
- Annotate eslint results via eslint formatterget-plugin-releases
- Get latest releases versions from WordPress or from a plugin.get-release-notes
- Get release notes via GitHub, infer the next version and taghook-documentation
- Generate WordPress hook documentationmerge-trunk-develop-pr
- Create a PR to mergetrunk
todevelop
after an extension releasephpcs-diff
- Run PHPCS to the changed lines of code, set error annotations to a pull requestprepare-extension-release
- Create the release branch & PR with checklistprepare-mysql
- Enable MySQL, handle authentication compatibilityprepare-node
- Set up Node.js with a specific version, load npm cache, install Node dependenciesprepare-php
- Set up PHP with a specific version and tools, load Composer cache, install Composer dependenciespublish-extension-dev-build
- Publish extension development buildrun-qit-annotate
- Runs QIT test and annotates the resultsrun-qit-extension
- Run QIT tests for a given extensionstylelint-annotation
- Annotate stylelint results via stylelint formatterupdate-version-tags
- Update version tags
- Install
node
with version >= 14 - Install node modules
npm i
- Install
composer
with version >= 2 - Run
composer install
in the action directory - Write tests as needed for changes to the action(s)
- Run
composer test
to run the tests, andcomposer test:coverage
to generate an HTML coverage report
/packages/github-actions/ # The root of actions
├── actions/ # All actions to be exposed in the release build
│ ├── prepare-node/ # Composite action
│ │ ├── action.yml
│ │ └── README.md # How to use this action
│ ├── update-version-tags/ # JavaScript action
│ │ ├── src/ # Script sources
│ │ │ ├── index.js
│ │ │ └── parse-version.js
│ │ ├── action.yml
│ │ └── README.md
│ └── hook-documentation/ # PHP action
│ ├── src/ # Script sources
│ ├── tests/ # Unit tests for the action
│ ├── coverage/ # Directory containg Code coverage report after `composer test:coverage` is run
│ ├── composer.json # The necessary file used to identify this as a PHP action
│ └── action.yml # The action file
├── utils/ # Sources of the shared files
│ └── do-something.js
├── package.json # The required dependent packages of the scripts, tests, build, and etc
└── README.md # The overall info about this Github actions package
- The
src
directories of JavaScript actions will be skipped in the release build. - When adding a new script that needs to be built, add its build script to package.json and make sure it will be called in
npm run build
.
Create a test build on the given branch and commit it to a separate branch with the -test-build
suffix to facilitate testing and development.
- Go to Workflow GitHub Actions - Create Test Build
- Manually run the workflow with the target branch.
- Wait for the triggered workflow run to complete.
- View the summary of the workflow run to use the test build.
- Take the branch name
add/my-action
and action pathgreet-visitor
as an example:- After a test build is created, it should be able to test the custom action by
woocommerce/grow/greet-visitor@add/my-action-test-build
. - After the
add/my-action
branch is deleted, the Workflow GitHub Actions - Delete Test Build will delete themy-action-test-build
branch.
- After a test build is created, it should be able to test the custom action by
/ # Entry points for the caller repositories
├── prepare-node/
│ ├── action.yml
│ └── README.md
├── update-version-tags/
│ ├── update-version-tags.js # Built file
│ ├── action.yml
│ └── README.md
└── README.md # Document prompts viewers to find the correct source code
The release build will be committed to a standalone point in the git tree via the release workflow, to make these custom GitHub actions have better paths and can be fetched faster.
%%{
init: {
"gitGraph": {
"mainBranchName": "trunk",
"mainBranchOrder": 2
},
"themeVariables": {
"git0": "#2155CD",
"git1": "#5D8BF4",
"git2": "#66B7FF",
"git3": "#2FA4FF",
"gitBranchLabel0": "#FFFFFF",
"gitBranchLabel1": "#FFFFFF",
"gitBranchLabel2": "#FFFFFF",
"gitBranchLabel3": "#FFFFFF",
"tagLabelBorder": "#874356",
"tagLabelBackground": "#F73D93",
"tagLabelColor": "#FFFFFF",
"commitLabelBackground": "#DFDFDE",
"gitInv0": "#2155CD"
}
}
}%%
gitGraph
commit
commit
branch add/action-feature order: 3
commit
commit
checkout trunk
merge add/action-feature
branch release/actions order: 1
commit id: "Changelog"
commit id: "Bump version"
branch tmp/release-build order: 0
commit id: "Release build" type: HIGHLIGHT tag: "actions-v1.2.3"
checkout trunk
merge release/actions
- 🧑💻 Create the specific branch
release/actions
onto the target revision ontrunk
branch. - When the branch
release/actions
is created, will continue to commit the release content torelease/actions
branch.- Workflow GitHub Actions - Prepare New Release
- Prepend changelog to CHANGELOG.md.
- Update versions to package.json and package-lock.json.
- Creates a release PR from
release/actions
branch withtrunk
as the base branch.
- 🧑💻 Check if the new changelog content and updated version are correct.
- For a patch version like fixing bugs, increases the Z number. For example,
actions-v1.4.8
. - For a minor version like adding new features, increases the Y number and reset the Z to 0. For example,
actions-v1.5.0
. - For a major version like having incompatible changes, increases the X number and reset the Y and Z to 0. For example,
actions-v2.0.0
. - If something needs to be revised, append the changes in the release PR.
- For a patch version like fixing bugs, increases the Z number. For example,
- 🧑💻 If it's all good, approve the release PR to proceed with the next workflow.
- Once the release PR is approved, a workflow will create a new release with a new version tag.
- Workflow GitHub Actions - Create Release
- After publishing the new release, a workflow will continue to create and commit the release build. And then update the references of the corresponding major and minor version tags onto the new release.
- Workflow GitHub Actions - Release
- When the new release version is
actions-v1.4.8
, it should update the references ofactions-v1
andactions-v1.4
ontoactions-v1.4.8
. - When the new release version is
actions-v1.5.0
, it should update the reference ofactions-v1
and createactions-v1.5
tag ontoactions-v1.5.0
. - When the new release version is
actions-v2.0.0
, it should createactions-v2
andactions-v2.0
tags ontoactions-v2.0.0
.
- 🧑💻 Check if both release workflows are run successfully.
- 🧑💻 Merge the release PR.
💡 To create a test build based on a branch, please refer to the Create a test build section.
- Create a new release with a prerelease version tag. For example
actions-vX.Y.Z-pre
. - Check if the "GitHub Actions - Release" workflow is run successfully.
- Delete the testing releases and tags once they are no longer in use.
Made with 💜 by Woo.
We're hiring! Come work with us!