Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
58 lines
1.5 KiB
YAML
58 lines
1.5 KiB
YAML
name: docs-ci
|
|
|
|
on:
|
|
push:
|
|
branches: [main, feat/docs-docusaurus-v3]
|
|
pull_request:
|
|
branches: [main, feat/docs-docusaurus-v3]
|
|
|
|
jobs:
|
|
build:
|
|
permissions:
|
|
contents: write
|
|
issues: write
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Use Node.js 20
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build docs
|
|
run: npm run build
|
|
|
|
- name: Upload build artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: docs-build
|
|
path: build
|
|
|
|
- name: Deploy preview to GitHub Pages
|
|
if: github.event_name == 'pull_request'
|
|
uses: peaceiris/actions-gh-pages@v4
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
publish_dir: ./build
|
|
- name: Comment preview URL
|
|
if: github.event_name == 'pull_request'
|
|
uses: actions/github-script@v7
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
const repoName = context.repo.repo;
|
|
const previewUrl = `https://${{ github.repository_owner }}.github.io/${repoName}/`;
|
|
const body = `🚀 Docs preview ready: ${previewUrl}`;
|
|
await github.rest.issues.createComment({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
body,
|
|
});
|