--- name: mosaic-deploy description: 'Full end-to-end deployment flow: push branch → open PR → wait for CI → merge → deploy using the path documented by the stack. Use when deploying a feature branch to production or staging, or when asked to ship a completed feature.' --- # mosaic-deploy End-to-end deployment flow. ## Full Deploy Sequence ``` push branch → open PR → CI passes → merge → documented deploy path ``` ### Step 1: Push branch and open PR ```bash cd ~/src/-worktrees/ git push -u origin ~/.config/mosaic/tools/git/pr-create.sh -t "feat: ..." -b "..." -i # Note the PR number from output ``` ### Step 2: Wait for CI ```bash ~/.config/mosaic/tools/git/pr-ci-wait.sh -n ``` If CI fails, check: ```bash source ~/.config/mosaic/tools/_lib/credentials.sh && load_credentials woodpecker ~/.config/mosaic/tools/woodpecker/pipeline-status.sh -r / ``` ### Step 3: Merge ```bash cd ~/src/ ~/.config/mosaic/tools/git/pr-merge.sh -n -d ``` Always merge through `pr-merge.sh`: it runs the CI queue guard first and pins the merge to the reviewed head. If branch protection blocks the merge, that is a gate telling you something — a failing check, a moved head, or a missing review. Fix the cause; never route around it with a raw API call, a shared credential, or `force_merge`. Exceptional cases go to the operator or the coordinating seat, still merged through the wrapper. ### Step 4: Deploy Through the Documented Path Read the stack README before deploying: - If it documents `docker stack deploy` on the manager, use that deploy path and its verification procedure. - Use Portainer only when the estate holds a Portainer credential. Do not propose Portainer otherwise. For an authorized Portainer deployment: ```bash source ~/.config/mosaic/tools/_lib/credentials.sh && load_credentials portainer ~/.config/mosaic/tools/portainer/stack-redeploy.sh -n -p ``` Check a Portainer deployment: ```bash ~/.config/mosaic/tools/portainer/stack-status.sh -n ~/.config/mosaic/tools/portainer/stack-logs.sh -n -l 50 ``` ## Optional Portainer Stack Map For deployments that use Portainer, maintain a project → stack-name mapping in a skills-local override of this skill (local copies take precedence over the shipped canonical one). Example shape: | Project | Stack Name | | ------------ | ----------------- | | `sample-app` | `sample-app` | | `sample-api` | `sample-api-prod` | ## Notes - Workers open PRs but **never merge** — orchestrator or Merge Guard handles step 3+ - Docker Swarm image pinning: `-p` does not change a digest-pinned image. Follow the stack README's documented deployment procedure. - Worktrees: all coding work in `~/src/-worktrees/`, never in main checkout - Always clean up worktree after push: `git worktree remove ~/src/-worktrees/`