-
Notifications
You must be signed in to change notification settings - Fork 3
101 lines (88 loc) · 3.25 KB
/
build.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Build
# Controls when the workflow will run
on:
# Triggers the workflow on push events for all branches
push:
branches: [ main, master ]
pull_request:
branches:
- main
- master
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build_latex"
build_latex:
# The type of runner that the job will run on
runs-on: ubuntu-latest
container:
image: ghcr.io/tudalgo/algotex:latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# 1. Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Set up Git repository
uses: actions/checkout@v3
# 2. Link texmf folder to the current texmf home
- name: Link texmf folder to the current texmf home
run: |
ln -s /root/texmf $(kpsewhich -var-value=TEXMFHOME)
texhash --verbose
# 3. Build the documents
- name: "Build the documents"
run: |
make -j -C lecture compile
make -j -C exercises compile
make -j -C misc/linux_commands compile
mkdir -p pdfout
cp lecture/pdfout/*.pdf pdfout/
cp exercises/pdfout/*.pdf pdfout/
cp misc/linux_commands/pdfout/*.pdf pdfout/
# 4. Upload artifacts to GitHub
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v3
with:
name: Vorkurs-Materialien
path: "pdfout/*.pdf"
if-no-files-found: error
# 9. Get Date
# - name: Get current date
# id: date
# run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H-%M-%S.%N')"
#10 create a release
# - name: Create a release
# if: ${{ github.ref == 'refs/heads/main' && !env.ACT && github.repository == 'd120/vorkurs' }}
# uses: softprops/action-gh-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: snapshot-${{ steps.date.outputs.date }}
# name: snapshot-release-${{ steps.date.outputs.date }}
# files: "pdfout/*.pdf"
# fail_on_unmatched_files: true
# draft: false
# prerelease: false
deploy:
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: build_latex
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_SECRET_KEY }}
known_hosts: "just-a-placeholder-so-we-dont-get-errors"
- name: Adding Known Hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan -H login.d120.de > ~/.ssh/known_hosts
# save the pdf file from the previous workflow
- name: Save pdf file
uses: actions/download-artifact@v3
with:
path: .
name: Vorkurs-Materialien
- name: Deploy with rsync
run: rsync -avz * ${{ secrets.SSH_USER }}@login.d120.de:public_html