-
Notifications
You must be signed in to change notification settings - Fork 16
58 lines (48 loc) · 1.58 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 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