mirror of
https://github.com/gromlab-ru/slm-design.git
synced 2026-08-22 07:30:16 +03:00
113 lines
2.8 KiB
YAML
113 lines
2.8 KiB
YAML
name: Documentation
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
paths:
|
|
- '.github/workflows/docs.yml'
|
|
- 'docs/**'
|
|
- 'site/**'
|
|
- 'src-skills/**'
|
|
- 'skills/**'
|
|
- 'scripts/build-skill.mjs'
|
|
- 'scripts/check-skill.mjs'
|
|
- 'scripts/check-docs.mjs'
|
|
- 'scripts/check-site.mjs'
|
|
- 'scripts/lib/skill-bundle.mjs'
|
|
- 'scripts/lib/slugify-heading.mjs'
|
|
- 'package.json'
|
|
- 'package-lock.json'
|
|
pull_request:
|
|
paths:
|
|
- '.github/workflows/docs.yml'
|
|
- 'docs/**'
|
|
- 'site/**'
|
|
- 'src-skills/**'
|
|
- 'skills/**'
|
|
- 'scripts/build-skill.mjs'
|
|
- 'scripts/check-skill.mjs'
|
|
- 'scripts/check-docs.mjs'
|
|
- 'scripts/check-site.mjs'
|
|
- 'scripts/lib/skill-bundle.mjs'
|
|
- 'scripts/lib/slugify-heading.mjs'
|
|
- 'package.json'
|
|
- 'package-lock.json'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
concurrency:
|
|
group: pages
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: npm
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Check project
|
|
run: npm run check
|
|
|
|
- name: Resolve skill tree hash
|
|
id: skill
|
|
run: echo "tree_hash=$(git rev-parse HEAD:skills/slm-design)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Restore skill archive
|
|
id: skill-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ runner.temp }}/slm-design.zip
|
|
key: slm-design-zip-v1-${{ steps.skill.outputs.tree_hash }}
|
|
|
|
- name: Pack skill
|
|
if: steps.skill-cache.outputs.cache-hit != 'true'
|
|
run: >-
|
|
git archive
|
|
--format=zip
|
|
--prefix=slm-design/
|
|
--mtime=2000-01-01T00:00:00Z
|
|
--output="$RUNNER_TEMP/slm-design.zip"
|
|
"${{ steps.skill.outputs.tree_hash }}"
|
|
|
|
- name: Verify skill archive
|
|
run: unzip -t "$RUNNER_TEMP/slm-design.zip"
|
|
|
|
- name: Add skill archive to Pages
|
|
run: |
|
|
mkdir -p site/.vitepress/dist/downloads
|
|
cp "$RUNNER_TEMP/slm-design.zip" site/.vitepress/dist/downloads/slm-design.zip
|
|
|
|
- name: Configure Pages
|
|
uses: actions/configure-pages@v5
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
path: site/.vitepress/dist
|
|
|
|
deploy:
|
|
if: github.event_name != 'pull_request'
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
steps:
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v4
|