chore: add docs deploy to publish workflow#542
Conversation
Code Review by Qodo
1. Deploy runs on dry-run
|
PR Summary by QodoDeploy docs after publish via GitHub Actions using deploy.sh and secrets WalkthroughsDescription• Add a docs deployment step to the publish GitHub Actions workflow after real publishes. • Introduce a deploy.sh script that uploads and unpacks docs artifacts on a remote host. • Read deploy host/path/password from GitHub Secrets and install sshpass when needed. Diagramgraph TD
A["GitHub Actions: publish.yml"] --> B["Install sshpass"] --> C["Deploy docs (pnpm deploy:docs)"] --> D["deploy.sh"] --> E{{"Remote docs host"}}
S[("GitHub Secrets")] --> C
C --> Z["dist.zip"] --> D
subgraph Legend
direction LR
_wf["Workflow step"] ~~~ _sec[("Secret store")] ~~~ _ext{{"External system"}}
end
High-Level AssessmentThe following are alternative approaches to this PR: 1. Use SSH key auth (no sshpass/password)
2. Use a purpose-built deploy action (e.g., rsync/ssh deploy action)
Recommendation: The current approach (explicit deploy.sh invoked from publish.yml) is reasonable for a custom remote-host deployment and keeps the behavior transparent. If feasible, prefer SSH key-based auth over sshpass/password to reduce security risk and simplify runner setup; the workflow structure can remain the same with only credential handling changed. File ChangesOther (2)
|
| - name: Install deploy dependencies | ||
| run: sudo apt-get update && sudo apt-get install -y sshpass | ||
|
|
||
| - name: Deploy docs | ||
| env: | ||
| DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }} | ||
| DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }} | ||
| SERVER_PASSWORD: ${{ secrets.SERVER_PASSWORD }} | ||
| run: pnpm deploy:docs |
There was a problem hiding this comment.
1. Deploy runs on dry-run 🐞 Bug ≡ Correctness
In .github/workflows/publish.yml, the new docs deployment steps run unconditionally, so inputs.dry_run=true still attempts a real docs deployment. This breaks the expected “non-destructive” dry-run behavior and can unintentionally update docs or fail due to missing secrets.
Agent Prompt
### Issue description
The workflow has a `dry_run` input that only gates the `pnpm publish` command, but the newly added docs deployment steps always run. This makes dry-run executions still deploy docs.
### Issue Context
`inputs.dry_run` is already used in the `Publish packages` step; the deploy steps should follow the same contract and only run when `dry_run` is false.
### Fix Focus Areas
- .github/workflows/publish.yml[55-71]
### Suggested change
Add an `if:` condition to both the `Install deploy dependencies` and `Deploy docs` steps (or wrap them into a single guarded step block), e.g.:
```yaml
- name: Install deploy dependencies
if: ${{ inputs.dry_run != true }}
run: ...
- name: Deploy docs
if: ${{ inputs.dry_run != true }}
...
```
Optionally also guard on `secrets.DEPLOY_HOST`/`secrets.DEPLOY_PATH` being present if this workflow may run in environments without those secrets.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #542 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 26 26
Lines 5579 5579
Branches 1547 1547
=========================================
Hits 5579 5579 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Verification