challenge #81
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |