-
Notifications
You must be signed in to change notification settings - Fork 17
72 lines (61 loc) · 2.03 KB
/
Copy pathdocs.yml
File metadata and controls
72 lines (61 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: "Build and Deploy Documentation"
on:
push:
tags:
# Только для релизных тегов (v1.0.0, v2.3.4, etc.)
- 'v[0-9]+.[0-9]+.[0-9]+'
permissions:
contents: write
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: |
cd docs
npm install
- name: Build VitePress documentation
run: |
cd docs
npm run build
- name: Verify search index artifacts
run: |
test -f docs/dist/search/index.en.json
test -f docs/dist/search/index.ru.json
- name: Check for changes
id: verify-changed-files
run: |
if git diff --quiet docs/dist/; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push built documentation
if: steps.verify-changed-files.outputs.changed == 'true'
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add docs/dist/
if git diff --cached --quiet; then
echo "No documentation changes to commit. Skipping push."
exit 0
fi
git commit -m "docs: build documentation for ${GITHUB_REF_NAME} [skip ci]"
# Workflow runs on tag pushes, so HEAD is detached.
# Push explicitly to the repository default branch.
git push origin "HEAD:${DEFAULT_BRANCH}"
- name: Summary
run: |
echo "📚 Documentation built and committed for tag: ${GITHUB_REF_NAME}"
echo "🌐 External service will pull changes for easyp.tech"