Build and Deploy MkDocs Site #1716
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 Site | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - main | |
| workflow_dispatch: | |
| schedule: | |
| # اجرا هر 2 ساعت یکبار (در دقایق 0 ساعات زوج: 0, 2, 4, ..., 22) | |
| - cron: '0 */8 * * *' | |
| permissions: | |
| contents: write | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Configure Git Credentials | |
| run: | | |
| git config user.name github-actions[bot] | |
| git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.x | |
| - name: Set weekly cache key | |
| run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| key: mkdocs-material-${{ env.cache_id }} | |
| path: .cache # یا ~/.cache/pip | |
| restore-keys: | | |
| mkdocs-material- | |
| - name: Install dependencies | |
| run: pip install requests mkdocs-material mkdocs-minify-plugin # و سایر پلاگینها | |
| - name: Update release links in Markdown | |
| run: python update_links.py | |
| - name: Build and Deploy with gh-deploy | |
| run: mkdocs gh-deploy --force |