fix: install index #38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy MkDocs Versions with Mike | |
on: | |
push: | |
branches: | |
- 'cells-v4' | |
jobs: | |
sync-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout pydio/docs (pushed branch) | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.ref_name }} | |
- name: Debug workflow trigger | |
run: | | |
echo "Event: ${{ github.event_name }}" | |
echo "Branch: ${{ github.ref_name }}" | |
echo "Repository: ${{ github.repository }}" | |
- name: Checkout main for config and resources | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
path: main-config | |
# - name: Sync workflow file to cells-v4 and cells-v5 | |
# if: github.ref_name == 'main' && contains(github.event.commits.*.added, '.github/workflows/build-docs.yaml') || contains(github.event.commits.*.modified, '.github/workflows/build-docs.yaml') | |
# run: | | |
# git config user.name "GitHub Action" | |
# git config user.email "[email protected]" | |
# for branch in cells-v4 cells-v5 pydio-v8; do | |
# git checkout $branch || git checkout -b $branch | |
# mkdir -p .github/workflows | |
# cp .github/workflows/build-docs.yaml .github/workflows/ | |
# git add .github/workflows/build-docs.yaml | |
# git commit -m "Sync build-docs.yaml from main to $branch" || echo "No changes to commit" | |
# git push origin $branch | |
# done | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Copy config and resources from main | |
run: | | |
cp main-config/mkdocs.yml . | |
cp main-config/requirements.txt . | |
mkdir -p resources docs/assets overrides | |
cp -r main-config/resources/* resources/ || echo "resources not found" | |
cp main-config/docs/assets/custom.css docs/assets/ || echo "custom.css not found" | |
cp -r main-config/overrides/* overrides/ || echo "error in copping onverrides" | |
rm -rf main-config | |
- name: Copy docs to docs repo | |
run: | | |
ls -lah | |
cp resources/pydio-favicon.png docs | |
cp -r admin-guide docs | |
cp -r cellsflows docs | |
cp -r developer-guide docs | |
cp -r knowledge-base docs | |
cp index.md docs | |
- name: Debug contents | |
run: | | |
ls -la . | |
ls -la docs/ || echo "docs/ not found" | |
ls -la resources/ || echo "resources/ not found" | |
ls -la docs/assets/ || echo "docs/assets/ not found" | |
ls -la overrides/ || echo "overrides/ not found" | |
cat docs/index.md || echo "index.md not readable" | |
cat resources/fix_index.html || echo "fix_index.html not readable" | |
cat docs/cellsflows/1_preset_flows/1_efficient-system-maintenance/0_backup-personal-files.md || echo "File not readable" | |
- name: Initialize gh-pages if not exists | |
run: | | |
git fetch origin gh-pages || { | |
echo "gh-pages does not exist, creating it" | |
git checkout --orphan gh-pages | |
git rm -rf . | |
echo "# Pydio Docs" > README.md | |
git add README.md | |
git config user.name "GitHub Action" | |
git config user.email "[email protected]" | |
git commit -m "Initialize gh-pages branch" | |
git push origin gh-pages | |
git checkout ${{ github.ref_name }} | |
} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Cache pip | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Validate MkDocs build | |
run: | | |
mkdocs build --verbose | |
ls -la site/ | |
- name: Deploy with mike | |
run: | | |
git config user.name "GitHub Action" | |
git config user.email "[email protected]" | |
VERSION=${GITHUB_REF_NAME} | |
ALIAS="" | |
if [ "$VERSION" = "cells-v4" ]; then | |
ALIAS="latest" | |
fi | |
echo "Deploying $VERSION with alias $ALIAS" | |
mike deploy --push "$VERSION" $ALIAS 2>&1 | tee mike_deploy.log | |
if [ $? -ne 0 ]; then | |
cat mike_deploy.log | |
echo "mike deploy failed" | |
exit 1 | |
fi | |
if [ "$VERSION" = "cells-v4" ]; then | |
echo "Setting default to cells-v4" | |
mike set-default --push cells-v4 2>&1 | tee mike_default.log | |
if [ $? -ne 0 ]; then | |
cat mike_default.log | |
echo "mike set-default failed" | |
exit 1 | |
fi | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Debug contents after mike build | |
run: | | |
ls -la . | |
ls -lah docs | |
ls -lah resources | |
ls -lah site | |
cat mkdocs.yml | |
- name: Copy custom files to gh-pages | |
run: | | |
git config user.name "GitHub Action" | |
git config user.email "[email protected]" | |
git fetch origin gh-pages | |
git checkout gh-pages | |
VERSION=${GITHUB_REF_NAME} | |
mkdir -p "$VERSION" | |
cp resources/fix_index.html "$VERSION/index.html" || echo "fix_index.html not found" | |
cp resources/versions.json versions.json || echo "versions.json not found" | |
git add "$VERSION/index.html" versions.json | |
git commit -m "Add custom index and versions.json for $VERSION" || echo "No changes to commit" | |
git push origin gh-pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |