Adapt bootstrap and autodeploy commands to GitHub Actions#979
Adapt bootstrap and autodeploy commands to GitHub Actions#979
Conversation
- Update BootstrapTrait to provide clearer instructions for GitHub Actions setup - Update DeploymentTrait::deployConfigAutodeploy to work with GitHub Actions secrets - Remove outdated Travis CI encryption logic - Remove template file handling that no longer exists - Update instructions to match current GH Actions workflow requirements - Update README.md to clarify automatic deployment setup - Note that bootstrap automatically updates githubProject variable - Clarify that GitHub Actions workflows are pre-configured - Streamline instructions to match new autodeploy output Co-authored-by: AronNovak <114076+AronNovak@users.noreply.github.com>
| $this->say(""); | ||
| $this->say("3. Review and commit the encrypted key file (pantheon-key.enc)"); | ||
| $this->say("2. Set up the following GitHub Secrets:"); | ||
| $this->say(" - Go to: Settings → Secrets and variables → Actions → Secrets → New repository secret"); |
There was a problem hiding this comment.
@copilot Can we automate it with gh CLI? If yes, we can install it on-demand inside DDEV and help the user to accomplish this!
There was a problem hiding this comment.
Yes! Added gh CLI automation in commit 82479da.
The command now:
- Detects if
ghCLI is available - Offers to automatically set up GitHub Secrets (TERMINUS_TOKEN, PANTHEON_DEPLOY_KEY, GH_TOKEN) and Variables (PANTHEON_GIT_URL)
- Falls back to manual instructions if gh CLI is not available or user declines
The gh CLI can be installed on-demand in DDEV, and users will be prompted to confirm before any secrets are set.
- Fix undefined $organization variable in BootstrapTrait (should be $github_organization) - Remove unused parameters from deployConfigAutodeploy function - Update docblock to reflect actual function behavior - Remove misleading documentation about branch parameters in README Co-authored-by: AronNovak <114076+AronNovak@users.noreply.github.com>
- Detect if gh CLI is available and offer to automate setup - Automatically set TERMINUS_TOKEN, PANTHEON_DEPLOY_KEY, GH_TOKEN secrets - Automatically set PANTHEON_GIT_URL variable - Fall back to manual instructions if gh CLI not available or user declines - Add printManualInstructions() helper method - Update README to mention automated setup option Co-authored-by: AronNovak <114076+AronNovak@users.noreply.github.com>
| ->run() | ||
| ->wasSuccessful(); | ||
|
|
||
| if ($gh_available) { |
There was a problem hiding this comment.
@copilot This is not enough. We are inside DDEV, we can sudo and install gh if it's missing.
There was a problem hiding this comment.
Done in commit 9dca072. The command now automatically installs gh CLI using sudo if it's not found in the DDEV environment. Installation uses apt with quiet flags to minimize output noise. If installation fails, it falls back to manual instructions.
- Automatically install gh CLI using apt if not found - Use sudo to install packages in DDEV environment - Add quiet flags to apt commands to reduce output noise - Fall back to manual instructions if installation fails - Ensure remaining steps (SSH key setup) always show - Update README to reflect automatic installation Co-authored-by: AronNovak <114076+AronNovak@users.noreply.github.com>
| $this->say("GitHub CLI (gh) is not installed. Installing it now..."); | ||
|
|
||
| // Install gh CLI on Ubuntu/Debian. | ||
| $install_commands = [ |
There was a problem hiding this comment.
This (gh check and init) should be in a helper function, to keep deployConfigAutodeploy more readable. refactor accordingly
Following the Travis CI → GitHub Actions migration in #952, the
bootstrap:projectanddeploy:config-autodeploycommands still contained Travis CI-specific logic and outdated instructions.Changes
DeploymentTrait::deployConfigAutodeploy()
$github_deploy_branchand$pantheon_deploy_branchparametersprintManualInstructions()helper method for fallback scenariosBootstrapTrait::bootstrapProject()
README.md
$githubProjectvariable in DeploymentTraitContext
The bootstrap process already correctly updates
DeploymentTrait.phpline 107-110 with the new project's GitHub org/name. GitHub Actions workflows in.github/workflows/are already functional and use GitHub's native Secrets/Variables instead of encrypted files.Users now have a completely automated setup experience in DDEV - gh CLI is automatically installed if missing, and GitHub Secrets/Variables can be configured with a single confirmation prompt. Manual instructions are still provided as a fallback if needed.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.