Skip to content

Instantly share code, notes, and snippets.

@josejuansanchez
Created February 21, 2024 12:30
Show Gist options
  • Save josejuansanchez/87f343d818ec7823c910d35db9811a78 to your computer and use it in GitHub Desktop.
Save josejuansanchez/87f343d818ec7823c910d35db9811a78 to your computer and use it in GitHub Desktop.
Workflow para generar documentación con MkDocs y publicarla en un branch
name: build-push-mkdocs
# Eventos que desescandenan el workflow
on:
push:
branches: ["main"]
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Job para crear la documentación de mkdocs
build:
# Indicamos que este job se ejecutará en una máquina virtual con la última versión de ubuntu
runs-on: ubuntu-latest
# Definimos los pasos de este job
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@fake.email.org
- name: Install Python3
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install Mkdocs
run: |
pip install mkdocs
pip install mkdocs-material
- name: Build MkDocs
run: |
cd documentacion/guia-completa-mkdocs
mkdocs build
- name: Push the documentation in a branch
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: mkdocs # The branch name where you want to push the assets
FOLDER: documentacion/guia-completa-mkdocs/site # The directory where your assets are generated
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token
MESSAGE: "Build: ({sha}) {msg}" # The commit message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment