Initial commit

This commit is contained in:
2026-06-13 21:05:02 +03:00
commit 05e55fa171
+101
View File
@@ -0,0 +1,101 @@
name: 'Docusaurus Deploy'
description: 'Builds Docusaurus docs from repo and deploys to S3'
inputs:
docs-path:
description: 'Path to docs directory in calling repo'
default: 'docs'
runs:
using: 'composite'
steps:
- name: Compute target URL
shell: bash
run: |
REF="${{ github.head_ref || github.ref_name }}"
REPO="${{ github.event.repository.name }}"
ORG="${{ github.repository_owner }}"
if [[ "$REF" == "main" || "$REF" == "master" ]]; then
URL="http://${REPO}.${ORG}.docs.jt4d.ru.net"
else
URL="http://${REF}.${REPO}.${ORG}.docs.jt4d.ru.net"
fi
echo "TARGET_URL=$URL" >> $GITHUB_ENV
echo "S3_PATH=${ORG}.${REPO}.${REF}" >> $GITHUB_ENV
- name: Set docs status pending
shell: bash
run: |
curl -s -X POST \
-H "Authorization: token ${{ github.token }}" \
-H "Content-Type: application/json" \
-d '{
"state": "pending",
"context": "Docs",
"description": "building",
"target_url": "${{ env.TARGET_URL }}"
}' \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/statuses/${{ github.sha }}"
- name: Copy docs into Docusaurus
shell: bash
run: |
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: Install Docusaurus dependencies
shell: bash
working-directory: ${{ github.action_path }}docusaurus
run: yarn install --frozen-lockfile
- name: Build docs
shell: bash
working-directory: ${{ github.action_path }}docusaurus
run: yarn docusaurus build --out-dir ${{ github.workspace }}/generated-docs
- name: Upload to S3
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ vars.DOCUSERVIX_S3_ACCESS }}
AWS_SECRET_ACCESS_KEY: ${{ vars.DOCUSERVIX_S3_SECRET }}
run: |
aws s3 sync generated-docs/ \
s3://${{ vars.DOCUSERVIX_S3_BUCKET }}/docs.${{ env.S3_PATH }}\
--endpoint-url ${{ vars.DOCUSERVIX_S3_URL }} \
--acl public-read \
--delete
- name: Set docs status success
if: success()
shell: bash
run: |
curl -s -X POST \
-H "Authorization: token ${{ github.token }}" \
-H "Content-Type: application/json" \
-d '{
"state": "success",
"context": "Docs",
"description": "deployed",
"target_url": "${{ env.TARGET_URL }}"
}' \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/statuses/${{ github.sha }}"
- name: Set docs status failure
if: failure()
shell: bash
run: |
curl -s -X POST \
-H "Authorization: token ${{ github.token }}" \
-H "Content-Type: application/json" \
-d '{
"state": "failure",
"context": "Docs",
"description": "build failed",
"target_url": "${{ env.TARGET_URL }}"
}' \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/statuses/${{ github.sha }}"