Skip to content

Commit

Permalink
Vytvoření jednotného stylu (#1)
Browse files Browse the repository at this point in the history
* Přidání složek minted do .gitignore

* Jednotný styl dokumentu synchronizovaný se státnicovými otázkami

- 'shared.tex' byl převzat z repozitáře MPC-IBE-SZZ, nyní ale bude zdroj
  pro něj a všechny změny by se měly nejprve aplikovat zde.
- 'main.tex' nyní obsahuje více příkazů, aby nebylo třeba
  do 'shared.tex' zasahovat vůbec a bylo ho možné aktualizovat bez
  nutnosti kontroly změn.

* Vylepšení jednotného stylu

* Přidané GH Actions, .gitignore template, upravený README, formatting

* Přidání možnosti vypnout 'minted'

Co-authored-by: czechbol
  • Loading branch information
kamen-u-cesty committed Dec 29, 2021
1 parent 65ca9b8 commit f8874a4
Show file tree
Hide file tree
Showing 10 changed files with 733 additions and 189 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Build all template PDF and release it

# Feel free to increment this counter in your attempts to do things
# the smart way instead of the easy way.
#
# total_hours_wasted = 17


on:
push:
branches:
- main
paths:
- "**/*.tex"
- "**/*.png"
- "**/*.jpg"
workflow_dispatch:

jobs:
# build šablony
build:
runs-on: ubuntu-latest

steps:
- name: Set up Git repository
uses: actions/checkout@v2

# kompilace
- name: Build ${{ matrix.dir }}
uses: xu-cheng/latex-action@v2
with:
latexmk_shell_escape: true
working_directory: ${{ matrix.dir }}
root_file: main.tex

- name: Set env
run: echo "NAME=$(grep -F "\newcommand{\subject}" main.tex | cut -d'{' -f 3 | cut -d'}' -f 1)" >> $GITHUB_ENV

# nahrání pro pozdější stažení
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
# název zip souboru se specifickým jménem předmětu
name: ${{ env.NAME }}
# co se má uložit do zip souboru
path: main.pdf

# vytvoření prázdného releasu
release:
runs-on: ubuntu-latest

outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}

steps:
- name: Set up Git repository
uses: actions/checkout@v2

- name: Create tag
id: create_tag
run: |
tag=build-$(date +%Y%m%d-%H%M%S)
echo "::set-output name=tag::$tag"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.create_tag.outputs.tag }}
release_name: ${{ steps.create_tag.outputs.tag }}
draft: false
prerelease: false

# přidání jednotlivých pdf předmětů do releasu
addBuilt:
runs-on: ubuntu-latest
# potřeba listOfDirectories pro vytvoření jobs matrix
needs: [ build, release ]

steps:
- uses: actions/checkout@v2

- name: Set env
run: echo "NAME=$(grep -F "\newcommand{\subject}" main.tex | cut -d'{' -f 3 | cut -d'}' -f 1)" >> $GITHUB_ENV

# stažení dříve nahráneho zip souboru v subjects jobu
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: ${{ env.NAME }}

# přidání do releasu
- name: Upload artifact to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
# cesta k souboru
asset_path: ./main.pdf
# název v releasu
asset_name: ${{ env.NAME }}.pdf
asset_content_type: application/pdf
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test if template is possible to be built

on:
pull_request:
types: [opened, reopened, edited, synchronize]
branches:
- main

jobs:
# build šablony
build:
runs-on: ubuntu-latest

steps:
- name: Set up Git repository
uses: actions/checkout@v2

# kompilace
- name: Build šablony
uses: xu-cheng/latex-action@v2
with:
latexmk_shell_escape: true
root_file: main.tex
Loading

0 comments on commit f8874a4

Please sign in to comment.