Cross-Repo CI
About 1037 wordsAbout 3 min
2026-09-01
When posts are pushed to the content repo, a GitHub Actions workflow dispatches an event to the theme repo. The theme repo checks out content at that specific commit SHA, builds the site, and deploys it. This enables reproducible builds tied to specific commits.
Both repositories provide workflow templates:
- Content repo template:
.github/workflows/trigger-build.yml.example - Theme repo template:
.github/workflows/deploy.yml.example
Required Access Tokens
| Secret | Repository | Required Permissions |
|---|---|---|
DISPATCH_TOKEN | Content Repo | Contents: Read and write on the theme repo |
CONTENT_REPO_TOKEN | Theme Repo | Contents: Read on the content repo (optional if public) |
See Access Tokens for generation instructions.
Step 1: enable the content repo workflow
In your content repo root, copy the template file:
cp .github/workflows/trigger-build.yml.example .github/workflows/trigger-build.ymlUpdate repository paths in the workflow:
jobs:
validate:
uses: YOUR_NAME/Shirone/.github/workflows/content-validate.yml@main
with:
theme_repository: YOUR_NAME/Shirone
dispatch:
needs: validate
runs-on: ubuntu-latest
steps:
- uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.DISPATCH_TOKEN }}
repository: YOUR_NAME/Shirone
event-type: content-updated
client-payload: '{"sha": "${{ github.sha }}"}'Key points:
event-typemust remaincontent-updated;client-payloadmust includeshato avoid building outdated commits;validatecalls the theme validation workflow and halts if syntax errors exist.
This workflow triggers only on modifications inside content/, config/, data/, assets/, public/, or shirone.content.json.
Step 2: configure repository secrets
Content Repo: Navigate to Settings -> Secrets and variables -> Actions, and add DISPATCH_TOKEN.
Theme Repo: On the same page, add CONTENT_REPO_TOKEN with read permissions on the content repo.



Step 3: enable the theme workflow
In your theme repo root, copy the template file:
cp .github/workflows/deploy.yml.example .github/workflows/deploy.ymlUpdate CONTENT_REPOSITORY with your content repository path:
env:
CONTENT_REPOSITORY: YOUR_NAME/my-blog-content
CONTENT_WORKING_COPY: .content-srcScroll to the bottom of the file. The template provides ready-to-use snippets for four deployment targets (commented out by default). Choose the one matching your deployment goal, uncomment it by removing #, and keep the other options commented out.
Option A: Deploy to Vercel (Upload Pre-Built Files)
Use this when your site is hosted on Vercel, but you prefer GitHub Actions to compile the pages.
- name: Deploy to Vercel
run: |
pnpm dlx vercel@latest deploy dist --prod --yes \
--token "$VERCEL_TOKEN"
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}- Required Secrets: Add
VERCEL_TOKEN,VERCEL_ORG_ID, andVERCEL_PROJECT_IDunder Theme Repo Actions settings; - Platform settings: In the Vercel dashboard, clear the Build Command and disable automated git builds so Vercel does not build twice;
- Reference: Vercel Deployment Guide.
Option B: Deploy to GitHub Pages (Free Static Hosting)
Use this when hosting static pages directly on GitHub Pages.
Update permissions at the top of deploy.yml to include pages: write and id-token: write:
permissions:
contents: read
pages: write
id-token: writeThen enable the Pages deployment snippet at the end of the file:
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist
- name: Deploy to Pages
id: deployment
uses: actions/deploy-pages@v4- Platform settings: Under Theme Repo Settings -> Pages, set Source to
GitHub Actions; - Reference: GitHub Pages Guide.
Option C: Deploy to Own Server / VPS (rsync Sync)
Use this when you own a cloud host or VPS and serve pages via Nginx.
- name: Deploy to server
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
DEPLOY_DIR: /var/www/shirone
run: |
set -euo pipefail
mkdir -p ~/.ssh && chmod 700 ~/.ssh
printf '%s\n' "$DEPLOY_SSH_KEY" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -H "$DEPLOY_HOST" >> ~/.ssh/known_hosts
rsync -az --delete -e "ssh -i ~/.ssh/deploy_key" \
dist/ "$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_DIR/dist/"- Required Secrets: Add
DEPLOY_HOST(server IP),DEPLOY_USER(username),DEPLOY_SSH_KEY(private key), andDEPLOY_DIR(web root); - Behavior: Connects to your server over SSH, uploads only changed files, and removes outdated files automatically;
- Reference: Server Deployment Guide.
Option D: Trigger Platform Rebuild (Deploy Hook)
Use this when hosting on platforms like Netlify or EdgeOne that compile sites using their own runners.
In this setup, Actions sends an HTTP notification to the platform's webhook URL, and the platform pulls the repo and builds the site on its own:
- name: Trigger platform build
env:
DEPLOY_HOOK: ${{ secrets.DEPLOY_HOOK }}
run: |
set -euo pipefail
curl --fail-with-body --silent --show-error --retry 3 --retry-delay 2 \
--max-time 30 --request POST "$DEPLOY_HOOK"- Required Secrets: Add
DEPLOY_HOOK(platform webhook URL); - Platform settings: Keep the build command as
pnpm buildin the platform dashboard and configureCONTENT_REPO_URLto fetch content; - Reference: Deployment Hooks Guide.
Note
Options A, B, and C upload ready-to-serve dist/ files; disable platform native builds in their dashboards. Option D requires keeping the platform build command. Do not enable both approaches simultaneously.
Step 4: verify
Edit any post in the content repo, commit, and push:
git add . git commit -m "docs: test automated build" git push origin mainOpen Actions in the content repo and verify that
validateanddispatchsucceed.Open Actions in the theme repo and confirm the
content-updatedrun succeeds.Refresh the blog site to verify that updates appear correctly.
If any step fails, check the Actions log in that repository first. Token permission issues usually surface during dispatch or checkout steps. See Troubleshooting.
Next steps
- Automated Build and Deployment Workflows: Complete workflow source code and execution logic
- Server Deployment: Build with GitHub Actions and sync via rsync
- Deployment Overview: Pick a hosting platform and bring the site online
- Deployment Hooks: Let the hosting platform pull and build on its own
Copyright
Copyright Ownership:Dawn6666666
License under:Attribution 4.0 International (CC-BY-4.0)