This repo is used to automate our CI/CD pipelines using GitHub Actions. It sets up both linting and deployment scripts for production and staging environments.
To add the CI/CD GitHub Actions to a repo, run the following command in the terminal to add the .github/workflows folder to the root of your repository:
Replace the following placeholders with your own values:
<your-github-username>: Your GitHub username<your-personal-access-token>: Your GitHub Personal Access Token (PAT)
git clone https://<github_username>:<github_personal_access_token>@github.com/builtmighty/.github.git && cd .github && rm -rf .git/ PULL_REQUEST_TEMPLATE.md rulesets/ && mkdir workflows && cd workflow_templates && mv * ../workflows && cd ../ && rm -rf workflow_templates && cd .. && rm -rf .github/README.md && git add .github && git commit -S -m "⚙️ Added CI/CD" && git push origin mainAfter running the command, you should see the .github/workflows folder added to your repository. Now, you will need to add the required Action secrets and variables. See the Actions Secrets section below for more information.
Add the following Action secrets/variables to the repo, by going to the repository > Settings > Secrets and variables > Actions.
PROD_REMOTE_WEB_ROOT
The web root for the production WordPress install. This is the location where wp-config.php should be set. Input the path without a trailing slash. On Kinsta, you can get this from the “Info” tab. ( IE /www/sitename/public )
PROD_SSH_HOST
The SSH host IP address for the production site. ( IE 123.45.678.9 )
PROD_SSH_PORT
The SSH port for connecting to the production server. ( IE 123456 )
PROD_SSH_USER
The user used to connect and log in to the production server via SSH. ( IE site_user )
RC_REMOTE_WEB_ROOT
The web root for the staging WordPress install. This is the location where wp-config.php should be set. Input the path without a trailing slash. On Kinsta, you can get this from the “Info” tab. ( IE /www/sitename/public )
RC_SSH_HOST
The SSH host IP address for the staging site. ( IE 123.45.678.9 )
RC_SSH_PORT
The SSH port for connecting to the staging server. ( IE 123456 )
RC_SSH_USER
The user used to connect and log in to the staging server via SSH. ( IE site_user )
SLACK_CHANNEL_ID
This is the specific Slack channel where notifications should be posted. You can find this ID, on Slack, by going to the channel. Click on the channel name in the top bar.
PLATFORM
The platform of the server you're deploying to. Options are
wordpressorlaravel.
PRODUCTION_URL
The production URL where deployments will deploy.
STAGING_URL
The staging URL where deployments will deploy.
WPENGINE_DEPLOY
(Variable) Set variable to true to turn on.
WPE_PROD
(Variable) The WP Engine production environment name.
WPE_STAGING
(Variable) The WP Engine staging environment name.
SSH_PRIVATE_KEY
The private key for the remote server.
SLACK_BOT_API_KEY
The Slack Bot API key is an API key used to interact with all of Built Mighty’s Slack channels. It allows us to post success and failure notifications to Slack channels related to each project. This is already set on the organizational level.
SLACK_TEAM_ID
This is the ID of our Built Mighty team, which encompasses all of our Slack channels. This is already set on the organizational level.
BOT_SIGNING_KEY
The bot signing key is a GitHub commit signing key, which allows our automated bot to grab uncommitted code on production or staging, commit it to a branch, and that code is verified with a proper signature. This is already set on the organizational level.
WPE_SSH_KEY
The WP Engine SSH deployment key, which is already set at the organization level. You can override it within the repository if need be.
Linting occurs automatically when a pull request is opened from a feature/branch into an rc/x.x.x branch OR from an rc/x.x.x into main/prod/production.
Deployments to staging occur after a pull request is merged from a feature/branch into an rc/x.x.x branch. Production deployments happen when a new release is published.
