Build website #1486
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: Build website | |
on: | |
schedule: | |
- cron: "0 0 * * *" # every day at midnight | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# git restore-mtime uses the ref log to find the correct timestamp | |
# for each file. This requires a full git history. The default value (1) | |
# creates a shallow checkout. | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
cache: 'pip' | |
- run: pip install -r requirements.txt | |
- name: Restore correct mtime | |
run: | | |
sudo apt install git-restore-mtime | |
git restore-mtime | |
- name: Build website | |
run: python3 update.py | |
- name: Push static files to gh-pages | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
if: ${{ env.API_TOKEN_GITHUB && github.event_name != 'pull_request' }} | |
uses: cpina/github-action-push-to-another-repository@main | |
with: | |
source-directory: 'static' | |
destination-github-username: ${{ secrets.WEBSITE_REPO_USER }} | |
destination-repository-name: ${{ secrets.WEBSITE_REPO_NAME }} | |
user-email: [email protected] | |
target-branch: gh-pages |