deploy #58684
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: deploy | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: 25/20 * * * * | |
workflow_dispatch: | |
jobs: | |
test-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install \ | |
-r ./requirements.txt \ | |
- name: Build GH pages | |
run: | | |
"${GITHUB_WORKSPACE}/build.sh" | |
cp -r "${GITHUB_WORKSPACE}/build/" ${{ runner.temp }}/ | |
- uses: actions/checkout@v4 | |
with: | |
ref: 'gh-pages' | |
- name: Commit updates | |
id: commit | |
continue-on-error: true # for expected error condition, see below | |
run: | | |
rm -rfv "${GITHUB_WORKSPACE}/*" | |
cp -r ${{ runner.temp }}/build/* "${GITHUB_WORKSPACE}"/ | |
git add -A . | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
# The following command fails if there are no updates (e.g. README change): | |
git commit -m "Deploy to GitHub Pages: ${GITHUB_SHA}" | |
- name: Deploy | |
uses: ad-m/[email protected] | |
if: steps.commit.outcome == 'success' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages |