-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (60 loc) · 1.79 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
59
60
61
62
63
name: CI
on:
pull_request:
push:
release:
types: [published]
jobs:
build:
runs-on: 'ubuntu-22.04'
steps:
- uses: actions/checkout@v1
- name: Setup python
uses: actions/setup-python@v1
with:
python-version: '3.10'
architecture: x64
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install dependencies
run: poetry install --no-dev
- name: Run stylecheck
run: poetry run flake8 .
- name: Run tests
run: GITHUB_REPOSITORY="" poetry run nose2
- name: Build static version
run: poetry run src/freeze.py
deploy:
needs: build
if: github.ref == 'refs/heads/master'
runs-on: 'ubuntu-22.04'
steps:
- uses: actions/checkout@v1
- name: Setup python
uses: actions/setup-python@v1
with:
python-version: '3.10'
architecture: x64
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install dependencies
run: poetry install --no-dev
- name: Build static version # TODO: should not be run here again but be passed from the build job
run: poetry run src/freeze.py
- name: Deploy to GitHub Pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
git config --global user.name "$GITHUB_ACTOR"
export REMOTE=$(git config remote.origin.url)
git checkout --orphan gh-pages
rsync -a \
--filter='P build' \
--filter='P .git/' \
--delete-excluded \
build/ .
rm -rf build/
git add -A
git commit -m "GitHub Actions build $(date -Iseconds)"
git push -fq "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" gh-pages