mirror of
https://github.com/github/gh-stack.git
synced 2026-09-14 20:26:28 +08:00
60 lines
1.3 KiB
YAML
60 lines
1.3 KiB
YAML
name: Docs
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'docs/**'
|
|
- '.github/workflows/docs.yml'
|
|
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
concurrency:
|
|
group: "pages-${{ github.ref }}"
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '24'
|
|
cache: 'npm'
|
|
cache-dependency-path: 'docs/package-lock.json'
|
|
|
|
- name: Install dependencies
|
|
working-directory: ./docs
|
|
run: npm ci --legacy-peer-deps
|
|
|
|
- name: Build documentation
|
|
working-directory: ./docs
|
|
run: npm run build
|
|
|
|
- name: Upload build artifacts
|
|
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
|
|
uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
path: ./docs/dist
|
|
|
|
deploy:
|
|
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
steps:
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v4
|