Skip to content

docs: add data structures guide for preparing retail data #126

docs: add data structures guide for preparing retail data

docs: add data structures guide for preparing retail data #126

name: Deploy Docs Preview to Cloudflare Pages
concurrency:
group: cloudflare-preview-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
branches:
- main
paths:
- "docs/**"
- "mkdocs.yml"
jobs:
deploy-preview:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.11"
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
# Disabled: a shared cache feeding the preview deploy is a poisoning vector.
enable-cache: "false"
- name: Install Dependencies
run: uv sync --locked
- name: Build docs
run: uv run mkdocs build --strict
- name: Verify build output
run: |
if [ ! -d "site" ]; then
echo "Error: site directory not found"
exit 1
fi
echo "Build output size: $(du -sh site)"
- name: Publish to Cloudflare Pages
id: cloudflare-deploy
uses: cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0 # v4.0.0
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
command: pages deploy site --project-name=openretailscience-docs --branch=${{ github.head_ref || github.ref_name }}
- name: Find existing comment
if: github.event_name == 'pull_request'
uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4.0.0
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: 'Cloudflare Pages Deployment'
- name: Create or update deployment comment
if: github.event_name == 'pull_request'
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
body: |
### 🚀 Cloudflare Pages Deployment
✅ Preview deployed successfully!
**Preview URL:** ${{ steps.cloudflare-deploy.outputs.deployment-url }}
**Deployment ID:** ${{ steps.cloudflare-deploy.outputs.pages-deployment-id }}
---
*This preview will be updated automatically when you push new changes to this PR.*
- name: Comment on deployment failure
if: failure() && github.event_name == 'pull_request'
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '### ❌ Cloudflare Pages Deployment Failed\\n\\nPlease check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.'
})