Skip to content

Commit

Permalink
ci: refine build process (sjtug#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzh authored Jun 3, 2021
1 parent a7de814 commit 085c108
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 145 deletions.
17 changes: 17 additions & 0 deletions .github/ci/build_variants.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e

rm -rf build
mkdir -p build

sed -e "s|documentclass\[.*\]|documentclass\[type=bachelor\]|g" main.tex > build/build-bachelor.tex
sed -e "s|documentclass\[.*\]|documentclass\[type=master\]|g" main.tex > build/build-master.tex

echo "--- Bachelor Template ---"
head build/build-bachelor.tex

echo "--- Master Template ---"
head build/build-master.tex

latexmk $@ -outdir=build build/build-*.tex
32 changes: 0 additions & 32 deletions .github/ci/install-ubuntu-miktex.sh

This file was deleted.

76 changes: 0 additions & 76 deletions .github/ci/install-ubuntu-texlive.sh

This file was deleted.

12 changes: 0 additions & 12 deletions .github/ci/texlive-ubuntu.profile

This file was deleted.

41 changes: 16 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,39 @@ on:
name: Build

jobs:
build-texlive:
build-xelatex:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: checkout code
- name: cache texlive installation
uses: actions/cache@v2
- uses: xu-cheng/texlive-action/full@v1
with:
path: |
/tmp/texlive
key: ${{ runner.os }}-texlive
- run: .github/ci/install-ubuntu-texlive.sh
name: install texlive
- run: latexmk -quiet -halt-on-error -time main.tex
name: build
- run: cat main.log
run: |
.github/ci/build_variants.sh -halt-on-error -time -quiet -xelatex
name: build with XeLaTeX
- run: cat build/build-*.log
name: display build log
if: ${{ failure() || success() }}
- uses: actions/upload-artifact@v2
with:
path: main.pdf
path: build/build-*.pdf
name: build-xelatex
name: upload build artifacts

build-miktex:
build-lualatex:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: checkout code
- name: cache miktex installation
uses: actions/cache@v2
- uses: xu-cheng/texlive-action/full@v1
with:
path: |
~/.miktex
key: ${{ runner.os }}-miktex
- run: .github/ci/install-ubuntu-miktex.sh
name: install miktex
- run: latexmk -quiet -halt-on-error -time main.tex
name: build
- run: cat main.log
run: |
.github/ci/build_variants.sh -halt-on-error -time -quiet -lualatex
name: build with LuaLaTeX
- run: cat build/build-*.log
name: display build log
if: ${{ failure() || success() }}
- uses: actions/upload-artifact@v2
with:
path: main.pdf
path: build/build-*.pdf
name: build-lualatex
name: upload build artifacts
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
on:
push:
branches:
- release
tags:
- "v*"

name: Release

jobs:
release-xelatex:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: checkout code
- uses: xu-cheng/texlive-action/full@v1
with:
run: |
.github/ci/build_variants.sh -halt-on-error -time -quiet -xelatex
name: build with XeLaTeX
- run: cat build/build-*.log
name: display build log
if: ${{ failure() || success() }}
- uses: actions/create-release@latest
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ github.event.head_commit.message }}
draft: true
prerelease: true
- name: add build-bachelor
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/build-bachelor.pdf
asset_name: build-bachelor.pdf
asset_content_type: application/pdf
- name: add build-master
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/build-master.pdf
asset_name: build-master.pdf
asset_content_type: application/pdf
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,5 @@ ehthumbs_vista.db
# Project specific
main.pdf
thesis-bot.yml

build/

0 comments on commit 085c108

Please sign in to comment.