Adds composer workflow to deploy vendor#27
Conversation
There was a problem hiding this comment.
Pull request overview
Adds documentation and a GitHub Actions workflow to build and deploy Composer vendor/ directories for WordPress plugins/themes to staging/production via SFTP, aligned with Issue #15’s request to include Composer in deployments.
Changes:
- Documented the vendor-deploy workflow and required GitHub Environments/secrets in
readme.md. - Added
.github/workflows/deploy-vendors.ymlto runcomposer installand uploadvendor/on pushes totrunk/staging(and via manual dispatch).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| readme.md | Adds deployment documentation and setup instructions for environment secrets. |
| .github/workflows/deploy-vendors.yml | New workflow to install Composer deps and upload vendor/ via SFTP to WP.com paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| ## 🚢 Deployment | ||
|
|
||
| Vendor folders for plugins and themes with a `composer.json` are built and deployed automatically via [`.github/workflows/deploy-vendors.yml`](.github/workflows/deploy-vendors.yml) on every push to `trunk` or `staging`. It can also be triggered manually via **Actions → Run workflow** in the GitHub UI. |
There was a problem hiding this comment.
The README implies any plugin/theme that has a composer.json will be built and deployed automatically, but the workflow is hardcoded to specific packages and requires manually adding steps for each new package. Consider rewording this to avoid implying auto-discovery (e.g., “Selected plugins/themes listed in the workflow…”).
| Vendor folders for plugins and themes with a `composer.json` are built and deployed automatically via [`.github/workflows/deploy-vendors.yml`](.github/workflows/deploy-vendors.yml) on every push to `trunk` or `staging`. It can also be triggered manually via **Actions → Run workflow** in the GitHub UI. | |
| Selected vendor folders for plugins and themes, as configured in [`.github/workflows/deploy-vendors.yml`](.github/workflows/deploy-vendors.yml), are built and deployed automatically on every push to `trunk` or `staging`. The workflow can also be triggered manually via **Actions → Run workflow** in the GitHub UI. |
| ftp-password: ${{ secrets.SFTP_PASSWORD }} | ||
| local-dir: plugins/bifrost-music/vendor/ | ||
| # vendor/ is gitignored, so --all forces upload of untracked files | ||
| git-ftp-args: ${{ inputs.dry_run == true && '--all --dry-run' || '--all' }} |
There was a problem hiding this comment.
inputs.dry_run is only defined for workflow_dispatch runs. Because this workflow also runs on push, this expression can fail to evaluate during push-triggered runs. Use a value that exists for all events (e.g., github.event.inputs.dry_run) and default it when not present.
| ftp-password: ${{ secrets.SFTP_PASSWORD }} | ||
| local-dir: themes/bifrost-noise/vendor/ | ||
| # vendor/ is gitignored, so --all forces upload of untracked files | ||
| git-ftp-args: ${{ inputs.dry_run == true && '--all --dry-run' || '--all' }} |
There was a problem hiding this comment.
Same issue as above: inputs.dry_run is not available on push events, so this expression can break push-triggered deployments. Prefer github.event.inputs.dry_run (or equivalent) with a safe default.
| working-directory: themes/bifrost-noise | ||
| run: composer install --no-dev --optimize-autoloader --no-interaction | ||
|
|
||
| - name: Upload theme vendor folder |
There was a problem hiding this comment.
themes/bifrost-noise does not exist in the repository (the themes/ directory currently contains only index.php). As written, this step will fail with a missing working directory. Either add the theme to the repo, correct the path/name, or gate this step so the workflow only runs when the directory exists.
| working-directory: themes/bifrost-noise | |
| run: composer install --no-dev --optimize-autoloader --no-interaction | |
| - name: Upload theme vendor folder | |
| if: ${{ hashFiles('themes/bifrost-noise/composer.json') != '' }} | |
| run: | | |
| if [ -d "themes/bifrost-noise" ]; then | |
| cd themes/bifrost-noise | |
| composer install --no-dev --optimize-autoloader --no-interaction | |
| else | |
| echo "themes/bifrost-noise directory not found; skipping theme dependency installation." | |
| fi | |
| - name: Upload theme vendor folder | |
| if: ${{ hashFiles('themes/bifrost-noise/composer.json') != '' }} |
|
|
||
| jobs: | ||
| deploy-vendors: | ||
| name: Build and Deploy Vendor Folders |
There was a problem hiding this comment.
workflow_dispatch allows manually running this workflow from any branch; with the current environment expression, any non-trunk run will target the staging environment and could upload unreviewed branch contents to staging. If that’s not intended, add a branch guard (job-level if:) to only allow trunk/staging, or require an explicit environment/confirm input for manual runs.
| name: Build and Deploy Vendor Folders | |
| name: Build and Deploy Vendor Folders | |
| if: ${{ github.ref_name == 'trunk' || github.ref_name == 'staging' }} |
Closes #15