Skip to content

CI

CI #182

Workflow file for this run

---
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