Skip to content

deploy-staging

deploy-staging #465

name: deploy-staging
# After CI is green on main, deploy every surface to staging through
# the shared deploy-surface reusable workflow (surface=all), so staging
# and production share one deploy engine and the site builds ONCE per
# staging deploy instead of once per surface.
#
# Inside deploy-surface the per-surface rsync legs still run as an
# independent matrix (fail-fast disabled): one surface failing does not
# block the others, and a single leg can be re-run on its own from the
# Actions tab without rebuilding.
on:
workflow_run:
workflows: [ci]
types: [completed]
branches: [main]
permissions:
contents: read
packages: read
jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: ./.github/workflows/deploy-surface.yml
with:
surface: all
env: staging
# Deploy exactly the commit CI just validated, not the tip of main.
ref: ${{ github.event.workflow_run.head_sha }}
secrets: inherit
deploy-index:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.workflow_run.head_sha }}
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/kaihacksai
chmod 600 ~/.ssh/kaihacksai
ssh-keyscan 92.205.150.56 >> ~/.ssh/known_hosts || true
- name: Deploy staging index via rsync (NO --delete)
run: |
# Rsync the staging/ directory to the staging vhost document root.
# NO --delete: must not touch sibling directories (main, architecture, cultures, plays, writing).
rsync -avz \
-e "ssh -i ~/.ssh/kaihacksai" \
./staging/ \
"c216mkgp1lzk@92.205.150.56:/home/c216mkgp1lzk/public_html/staging.kaihacks.ai/"