Deploy Documentation #164
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: Deploy Documentation | |
| on: | |
| # Runs on pushes to main branch | |
| push: | |
| branches: [ main ] | |
| # Allows manual triggering from the Actions tab | |
| workflow_dispatch: | |
| # Weekly schedule (Sunday at 2am UTC) | |
| schedule: | |
| - cron: '0 2 * * 0' | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Configure Git and perform checkout | |
| - name: Configure Git | |
| run: | | |
| git config --global advice.detachedHead false | |
| git config --global core.autocrlf false | |
| git config --global status.submoduleSummary false | |
| git config --global diff.ignoreSubmodules all | |
| git config --global fetch.recurseSubmodules false | |
| git config --global submodule.recurse false | |
| git config --global submodule.active false | |
| echo "Git configuration:" | |
| git config --list | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: false | |
| persist-credentials: false | |
| set-safe-directory: /home/runner/work/mainwp.dev/mainwp.dev | |
| # Verify theme files exist immediately after checkout | |
| - name: Verify Theme Files After Checkout | |
| run: | | |
| echo "Listing workspace root:" | |
| ls -la | |
| echo "---" | |
| echo "Checking dox-theme directory:" | |
| ls -la dox-theme/ || echo "dox-theme directory NOT FOUND" | |
| echo "---" | |
| echo "Checking dox-theme/assets directory:" | |
| ls -la dox-theme/assets/ || echo "dox-theme/assets directory NOT FOUND" | |
| echo "---" | |
| echo "Checking dox-theme/assets/js directory:" | |
| ls -la dox-theme/assets/js/ || echo "dox-theme/assets/js directory NOT FOUND" | |
| echo "---" | |
| echo "Checking dox-theme/assets/js/vendor directory:" | |
| ls -la dox-theme/assets/js/vendor/ || echo "dox-theme/assets/js/vendor directory NOT FOUND" | |
| echo "---" | |
| echo "Checking specific vendor file:" | |
| ls -la dox-theme/assets/js/vendor/jquery.min.js || echo "jquery.min.js NOT FOUND" | |
| - name: Verify repository state | |
| run: | | |
| echo "Repository structure:" | |
| find . -maxdepth 3 -name ".git" | sort | |
| echo "Checking for submodule entries:" | |
| git config --list | grep submodule || echo "No submodule configs found" | |
| echo "Checking Git index for submodule entries:" | |
| git ls-files --stage | grep 160000 || echo "No submodule entries in index" | |
| # Setup PHP | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.1' | |
| extensions: mbstring, intl, zip | |
| tools: composer:v2 | |
| # Setup Ruby for Jekyll | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2' | |
| bundler-cache: true | |
| # Install dependencies | |
| - name: Install Dependencies | |
| run: | | |
| cd hooks-generator | |
| composer install --no-dev --prefer-dist --no-progress | |
| cd .. | |
| bundle install | |
| # Clone MainWP repositories and remove .git directories | |
| - name: Clone MainWP repos | |
| run: | | |
| # Clean up any existing source directories | |
| rm -rf sources/mainwp-dashboard sources/mainwp-child | |
| # Create fresh sources directory | |
| mkdir -p sources | |
| # Clone and clean dashboard repository | |
| git clone https://github.com/mainwp/mainwp.git sources/mainwp-dashboard | |
| rm -rf sources/mainwp-dashboard/.git | |
| # Clone and clean child repository | |
| git clone https://github.com/mainwp/mainwp-child.git sources/mainwp-child | |
| rm -rf sources/mainwp-child/.git | |
| # Verify no .git directories remain | |
| echo "Checking for remaining .git directories:" | |
| find sources -name ".git" -type d || echo "No .git directories found in sources" | |
| # Generate hooks documentation | |
| - name: Generate hooks documentation | |
| run: | | |
| cd hooks-generator | |
| ./generate-categorized-hooks.sh | |
| # Build Jekyll site | |
| - name: Build Jekyll | |
| run: JEKYLL_ENV=production bundle exec jekyll build --verbose | |
| env: | |
| JEKYLL_ENV: production | |
| # Verify build output and compiled assets | |
| - name: Verify Build Output | |
| run: | | |
| echo "--- Workspace Root Contents ---" | |
| ls -la | |
| echo "--- _site Directory Contents ---" | |
| ls -la _site | |
| echo "--- _site/dox-theme/assets/js/ Contents (Recursive) ---" | |
| ls -laR _site/dox-theme/assets/js/ || echo "Directory _site/dox-theme/assets/js/ not found" | |
| echo "--- Compiled CSS Content ---" | |
| echo "style.css contents:" | |
| cat _site/dox-theme/assets/css/style.css || echo "style.css not found!" | |
| # Deploy to GitHub Pages | |
| - name: Deploy to GitHub Pages | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| folder: _site # Deploy the contents of the _site directory | |
| branch: gh-pages | |
| clean: true # Automatically remove deleted files from the deploy branch |