Skip to content

Commit 41bf3f6

Browse files
committed
Synchronizováno s FEKT.tex
1 parent 014be60 commit 41bf3f6

File tree

11 files changed

+990
-350
lines changed

11 files changed

+990
-350
lines changed

.github/workflows/release.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Build all template PDF and release it
2+
3+
# Feel free to increment this counter in your attempts to do things
4+
# the smart way instead of the easy way.
5+
#
6+
# total_hours_wasted = 17
7+
8+
9+
on:
10+
push:
11+
branches:
12+
- main
13+
paths:
14+
- "**/*.tex"
15+
- "**/*.png"
16+
- "**/*.jpg"
17+
workflow_dispatch:
18+
19+
jobs:
20+
# build šablony
21+
build:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Set up Git repository
26+
uses: actions/checkout@v2
27+
28+
# kompilace
29+
- name: Build ${{ matrix.dir }}
30+
uses: xu-cheng/latex-action@v2
31+
with:
32+
latexmk_shell_escape: true
33+
working_directory: ${{ matrix.dir }}
34+
root_file: main.tex
35+
36+
- name: Set env
37+
run: echo "NAME=$(grep -F "\newcommand{\subject}" main.tex | cut -d'{' -f 3 | cut -d'}' -f 1)" >> $GITHUB_ENV
38+
39+
# nahrání pro pozdější stažení
40+
- name: Upload artifact
41+
uses: actions/upload-artifact@v2
42+
with:
43+
# název zip souboru se specifickým jménem předmětu
44+
name: ${{ env.NAME }}
45+
# co se má uložit do zip souboru
46+
path: main.pdf
47+
48+
# vytvoření prázdného releasu
49+
release:
50+
runs-on: ubuntu-latest
51+
needs: [ build ]
52+
53+
outputs:
54+
upload_url: ${{ steps.create_release.outputs.upload_url }}
55+
56+
steps:
57+
- name: Set up Git repository
58+
uses: actions/checkout@v2
59+
60+
- name: Create tag
61+
id: create_tag
62+
run: |
63+
tag=build-$(date +%Y%m%d-%H%M%S)
64+
echo "::set-output name=tag::$tag"
65+
- name: Create Release
66+
id: create_release
67+
uses: actions/create-release@v1
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
with:
71+
tag_name: ${{ steps.create_tag.outputs.tag }}
72+
release_name: ${{ steps.create_tag.outputs.tag }}
73+
draft: false
74+
prerelease: false
75+
76+
# přidání jednotlivých pdf předmětů do releasu
77+
addBuilt:
78+
runs-on: ubuntu-latest
79+
# potřeba listOfDirectories pro vytvoření jobs matrix
80+
needs: [ build, release ]
81+
82+
steps:
83+
- uses: actions/checkout@v2
84+
85+
- name: Set env
86+
run: echo "NAME=$(grep -F "\newcommand{\subject}" main.tex | cut -d'{' -f 3 | cut -d'}' -f 1)" >> $GITHUB_ENV
87+
88+
# stažení dříve nahráneho zip souboru v subjects jobu
89+
- name: Download artifact
90+
uses: actions/download-artifact@v2
91+
with:
92+
name: ${{ env.NAME }}
93+
94+
# přidání do releasu
95+
- name: Upload artifact to Release
96+
uses: actions/upload-release-asset@v1
97+
env:
98+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
with:
100+
upload_url: ${{ needs.release.outputs.upload_url }}
101+
# cesta k souboru
102+
asset_path: ./main.pdf
103+
# název v releasu
104+
asset_name: ${{ env.NAME }}.pdf
105+
asset_content_type: application/pdf

.github/workflows/test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Test if template is possible to be built
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, edited, synchronize]
6+
branches:
7+
- main
8+
9+
jobs:
10+
# build šablony
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Set up Git repository
16+
uses: actions/checkout@v2
17+
18+
# kompilace
19+
- name: Build šablony
20+
uses: xu-cheng/latex-action@v2
21+
with:
22+
latexmk_shell_escape: true
23+
root_file: main.tex

0 commit comments

Comments
 (0)