Merge pull request #54 from SamErde/prerelease #129
This file contains 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 MkDocs to GitHub Pages | |
on: | |
push: | |
branches: | |
- main # The branch you want to deploy from | |
paths: # Only deploy MkDocs when the contents of the docs folder change or when this workflow changes. | |
- 'docs/**' | |
- '.github/workflows/Deploy MkDocs.yml' | |
- './mkdocs.yml' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: ✅ Checkout Repository | |
uses: actions/checkout@v4 | |
- name: 🐍 Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' # specify the Python version | |
- name: ➕ Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install mkdocs mkdocs-material | |
- name: 👷♂️ Build & Deploy MkDocs | |
run: | | |
mkdocs build | |
mkdocs gh-deploy --force | |
# Combine markdown files to create the MkDocs index and the repository readme | |
- name: 📖 Update Index & Readme | |
shell: pwsh | |
run: | | |
[int16]$LineNumber = (Select-String -Path '.\docs\index.md' -Pattern 'Summary' -List).LineNumber + 1 | |
$IndexTop = Get-Content -Path ./docs/index.md -TotalCount $LineNumber | |
$ModuleContent = Get-Content -Path ./docs/PSPreworkout.md | Select-Object -Skip 12 | |
$FooterContent = "`n</Details>`n" | |
$CombinedContent = $IndexTop + $ModuleContent + $FooterContent | |
$CombinedContent | Set-Content -Path ./docs/index.md | |
$ModuleContent = $ModuleContent.Replace( '](' , '](./docs/' ) | |
$CombinedContent = $IndexTop + $ModuleContent | |
$CombinedContent | Set-Content -Path ./README.md | |
# Copy-Item ./docs/index.md ./README.md | |
# git-auto-commit-action only runs on Linux-based platforms. | |
- name: 💾 Commit Changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: 'Copy MkDocs index to README' | |
file_pattern: 'docs/index.md README.md' |