-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Aktualizace šablony obsahující CI/CD
- Loading branch information
Showing
5 changed files
with
130 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
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 | ||
needs: [ build ] | ||
|
||
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 |
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
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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