github pages #1211
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: github pages | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: 11 06 * * * | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
# Number of commits to fetch. 0 indicates all history. | |
# Default: 1 | |
fetch-depth: 0 | |
- name: Setup Python | |
# https://github.com/actions/virtual-environments/issues/1202 | |
# uses: actions/setup-python@v1 | |
# with: | |
# python-version: '3.7' | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
architecture: x64 | |
- name: Cache dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: pip install pip-tools | |
- name: Update requirements | |
run: make update | |
- name: Make the site | |
run: make build-docs | |
- name: Commit files | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add requirements.txt | |
#git add docs/newsletter | |
git diff-index --quiet HEAD \ | |
|| git commit -m "chore: update dependency and publish newsletters" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./site |