Mcbed doc refactor #3
Workflow file for this run
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: Documentation | ||
| # Controls when the workflow will run | ||
| on: | ||
| # Triggers the workflow on push events but only for the main branch | ||
| push: | ||
| branches: [ main ] | ||
| # Triggers the workflow on pull request events | ||
| pull_request: | ||
| branches: [ main ] | ||
| # Allows you to run this workflow manually from the Actions tab | ||
| workflow_dispatch: | ||
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
| jobs: | ||
| # This workflow contains a single job called "build_documentation" | ||
| build_documentation: | ||
| # The type of runner that the job will run on | ||
| runs-on: ubuntu-latest | ||
| # Steps represent a sequence of tasks that will be executed as part of the job | ||
| steps: | ||
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.x' | ||
| - name: Install dependencies | ||
| run: | | ||
| pip install --upgrade pip | ||
| pip install -r docs/requirements.txt | ||
| - name: Build documentation | ||
| run: mkdocs build --config-file docs/mkdocs.yml | ||
| - name: Create commit | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
| run: | | ||
| git clone https://github.com/ICube-Robotics/ecat_ros2_workshop.git --branch gh-pages --single-branch gh-pages | ||
| cp -r docs/site/* gh-pages/ | ||
| cd gh-pages | ||
| git config --local user.email "[email protected]" | ||
| git config --local user.name "GitHub Action" | ||
| git add . | ||
| git commit -m "Update documentation" -a || true | ||
| - name: Push changes | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
| uses: ad-m/github-push-action@master | ||
| with: | ||
| branch: gh-pages | ||
| directory: gh-pages | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||