feat: добавление docusaurus

Reviewed-on: #1
Co-authored-by: Arswarog <arswarog@yandex.ru>
Co-committed-by: Arswarog <arswarog@yandex.ru>
This commit was merged in pull request #1.
This commit is contained in:
2026-06-15 10:02:01 +03:00
parent 05e55fa171
commit 8250d61f56
19 changed files with 10753 additions and 8 deletions
+20 -8
View File
@@ -5,6 +5,9 @@ inputs:
docs-path:
description: 'Path to docs directory in calling repo'
default: 'docs'
on-broken-links:
description: 'Behavior on broken links: throw, warn, or ignore'
default: 'throw'
runs:
using: 'composite'
@@ -17,13 +20,15 @@ runs:
ORG="${{ github.repository_owner }}"
if [[ "$REF" == "main" || "$REF" == "master" ]]; then
URL="http://${REPO}.${ORG}.docs.jt4d.ru.net"
URL="http://${REPO}.${ORG}.jt4d-wiki.ru.net"
S3_PATH="${ORG}.${REPO}"
else
URL="http://${REF}.${REPO}.${ORG}.docs.jt4d.ru.net"
URL="http://${REF}.${REPO}.${ORG}.jt4d-wiki.ru.net"
S3_PATH="${ORG}.${REPO}.${REF}"
fi
echo "TARGET_URL=$URL" >> $GITHUB_ENV
echo "S3_PATH=${ORG}.${REPO}.${REF}" >> $GITHUB_ENV
echo "S3_PATH=$S3_PATH" >> $GITHUB_ENV
- name: Set docs status pending
shell: bash
@@ -42,20 +47,27 @@ runs:
- name: Copy docs into Docusaurus
shell: bash
run: |
DOCUSAURUS_DIR="${{ github.action_path }}docusaurus"
DOCUSAURUS_DIR="${{ github.action_path }}/docusaurus"
rm -rf "${DOCUSAURUS_DIR}/docs"
cp -r "${{ inputs.docs-path }}" "${DOCUSAURUS_DIR}/docs"
cp "${{ github.workspace }}/.docuservix.yml" "${DOCUSAURUS_DIR}"
- name: Prepare docs
shell: bash
working-directory: ${{ github.action_path }}/docusaurus
run: node scripts/prepare-docs.mjs
- name: Install Docusaurus dependencies
shell: bash
working-directory: ${{ github.action_path }}docusaurus
working-directory: ${{ github.action_path }}/docusaurus
run: yarn install --frozen-lockfile
- name: Build docs
shell: bash
working-directory: ${{ github.action_path }}docusaurus
working-directory: ${{ github.action_path }}/docusaurus
env:
DOCUSERVIX_ON_BROKEN_LINKS: ${{ inputs.on-broken-links }}
DOCUSERVIX_URL: ${{ env.TARGET_URL }}
run: yarn docusaurus build --out-dir ${{ github.workspace }}/generated-docs
- name: Upload to S3
@@ -65,7 +77,7 @@ runs:
AWS_SECRET_ACCESS_KEY: ${{ vars.DOCUSERVIX_S3_SECRET }}
run: |
aws s3 sync generated-docs/ \
s3://${{ vars.DOCUSERVIX_S3_BUCKET }}/docs.${{ env.S3_PATH }}\
s3://${{ vars.DOCUSERVIX_S3_BUCKET }}/${{ env.S3_PATH }}\
--endpoint-url ${{ vars.DOCUSERVIX_S3_URL }} \
--acl public-read \
--delete