Skip to content

docs(website): add widget GIFs and demo to docs #10

docs(website): add widget GIFs and demo to docs

docs(website): add widget GIFs and demo to docs #10

Workflow file for this run

name: Deploy Docs to Cloudflare Pages
on:
push:
branches: [main]
paths:
- 'website/**'
- '.github/workflows/deploy-docs.yml'
pull_request:
paths:
- 'website/**'
- '.github/workflows/deploy-docs.yml'
workflow_dispatch:
permissions:
contents: read
deployments: write
pull-requests: write
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
- name: Install and build
if: hashFiles('website/package.json') != ''
working-directory: website
run: npm install && npm run build
# Production deploy (push to main)
- name: Deploy to Production
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: cloudflare/wrangler-action@v3
id: deploy-production
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy website/dist --project-name=aeojs --branch=main
# Preview deploy (pull requests)
- name: Deploy Preview
if: github.event_name == 'pull_request'
uses: cloudflare/wrangler-action@v3
id: deploy-preview
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy website/dist --project-name=aeojs --branch=${{ github.head_ref }}
# Comment preview URL on the PR
- name: Comment Preview URL
if: github.event_name == 'pull_request'
uses: actions/github-script@v8
with:
script: |
const branch = context.payload.pull_request.head.ref
.replace(/[^a-zA-Z0-9-]/g, '-')
.substring(0, 28);
const previewUrl = `https://${branch}.aeojs.pages.dev`;
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const botComment = comments.find(c =>
c.user.type === 'Bot' && c.body.includes('Docs Preview')
);
const body = `### Docs Preview\n\n**Preview URL:** ${previewUrl}\n\nThis preview was deployed from the latest commit on this PR.`;
if (botComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body,
});
}