-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (63 loc) · 1.91 KB
/
ci.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
64
65
66
67
68
69
70
71
72
73
74
---
name: CI
on:
pull_request:
push:
branches:
- master
- develop
schedule:
- cron: "0 1 * * 0" # at 01.00 week 0 ( every Sunday)
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo pip3 install -r requirements.txt
- name: Build E2x Docs
run: |
cd docs
make html
deploy:
name: Deploy E2x Docs
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo pip3 install -r requirements.txt
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_TOKEN }}
- name: Build and deploy image
shell: bash
env:
USERNAME: ${{ secrets.GH_USERNAME }}
TOKEN: ${{ secrets.GH_TOKEN }}
run: |
#deploy to ghcr.io
cd $GITHUB_WORKSPACE
docker build -t ghcr.io/digiklausur/e2x-docs:latest .
docker push ghcr.io/digiklausur/e2x-docs:latest
# Build e2x-docs and push to github page
cd docs
make html
REV_VERSION=$(git rev-parse --short HEAD)
# Clone, resync and push docs
git clone https://$USERNAME:$TOKEN@github.com/DigiKlausur/digiklausur.github.io.git
cp -r $GITHUB_WORKSPACE/docs/build/html/* digiklausur.github.io
cd digiklausur.github.io
git config --local user.name "e2x CI"
git config --local user.email "e2x@h-brs.de"
if [[ -z `git diff --exit-code` ]]; then echo "No changes to push; exiting..."; exit 0; fi
git add .
git commit -m "New release $REV_VERSION pushed"
git push origin master