Skip to content

Commit 1196baf

Browse files
authored
Initial commit
0 parents  commit 1196baf

36 files changed

+3931
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 4
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
end_of_line = lf
10+
11+
[*.{xml,yml}]
12+
indent_size = 2

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
* text=auto eol=lf
2+
*.cs linguist-detectable=true
3+
*.js linguist-detectable=false
4+
*.cshtml linguist-detectable=false
5+
*.razor linguist-detectable=false
6+
*.html linguist-detectable=false
7+
*.htm linguist-detectable=false
8+
*.xml linguist-detectable=false
9+
*.css linguist-detectable=false
10+
*.m linguist-detectable=false
11+
*.nb linguist-detectable=false
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: 'Build and Deploy LaTeX'
2+
on:
3+
workflow_call:
4+
inputs:
5+
file_name:
6+
description: 'LaTeX root file name without extension, example: MyTeXFile'
7+
required: true
8+
type: string
9+
10+
runs_on:
11+
description: 'Agent image'
12+
required: true
13+
type: string
14+
15+
workflow_name:
16+
description: 'Workflow name'
17+
required: true
18+
type: string
19+
20+
build_assets_path:
21+
description: 'Build assets path'
22+
required: true
23+
type: string
24+
25+
working_directory_for_latex:
26+
description: 'Working directory for LaTeX'
27+
required: true
28+
type: string
29+
30+
env:
31+
TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
32+
USERNAME: "kolosovpetro"
33+
EMAIL: "kolosovp94@gmail.com"
34+
MESSAGE: "CICD deploy of ${{ inputs.file_name }} PDF document"
35+
36+
jobs:
37+
build-pdf:
38+
runs-on: ${{ inputs.runs_on }}
39+
name: ${{ inputs.workflow_name }}
40+
41+
steps:
42+
- name: '🔎 Fetch sources 🔎'
43+
uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 0
46+
47+
- name: '⬇️ Install GitVersion ⬇️'
48+
uses: gittools/actions/gitversion/setup@v3.0.0
49+
with:
50+
versionSpec: '5.x'
51+
preferLatestVersion: true
52+
53+
- name: '🤔 Determine Version 🤔'
54+
uses: gittools/actions/gitversion/execute@v3.0.0
55+
with:
56+
useConfigFile: true
57+
58+
- name: '📜 Print Version 📜'
59+
run: |
60+
echo "SemVer: ${{ env.GitVersion_SemVer }}"
61+
echo "BranchName: ${{ env.GitVersion_BranchName }}"
62+
echo "ShortSha: ${{ env.GitVersion_ShortSha }}"
63+
newVersion="${{ env.GitVersion_SemVer }}+${{ env.GitVersion_BranchName }}.${{ env.GitVersion_ShortSha }}"
64+
echo "Next version: $newVersion"
65+
66+
- name: '🔄 Update version.tex 🔄'
67+
shell: bash
68+
run: |
69+
newVersion="${{ env.GitVersion_SemVer }}+${{ env.GitVersion_BranchName }}.${{ env.GitVersion_ShortSha }}"
70+
sed -i "s|Local-0.1.0|$newVersion|" "src/sections/version.tex"
71+
72+
- name: '🛠 Build PDF 🛠'
73+
uses: xu-cheng/latex-action@v3
74+
with:
75+
root_file: '${{ inputs.file_name }}.tex'
76+
working_directory: '${{ inputs.working_directory_for_latex }}'
77+
78+
- name: '⬆️ Upload build assets ⬆️'
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: '${{ inputs.file_name }}-${{ env.GitVersion_InformationalVersion }}'
82+
path: '${{ inputs.build_assets_path }}'
83+
84+
- name: '⬆️ Upload artifacts PDF ⬆️'
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: '${{ inputs.file_name }}-PDF-${{ env.GitVersion_InformationalVersion }}'
88+
path: '${{ inputs.working_directory_for_latex}}/${{ inputs.file_name }}.pdf'
89+
90+
- name: '📀 Clone repository 📀'
91+
run: |
92+
git clone https://${{ env.TOKEN }}@github.com/kolosovpetro/kolosovpetro.github.io.git ~/kolosovpetro.github.io
93+
cp src/${{ inputs.file_name }}.pdf ~/kolosovpetro.github.io/pdf/${{ inputs.file_name }}.pdf
94+
95+
- name: '❇️ Commit changes ❇️'
96+
run: |
97+
cd ~/kolosovpetro.github.io
98+
git config --global user.name "${{ env.USERNAME }}"
99+
git config --global user.email "${{ env.EMAIL }}"
100+
git add .
101+
git commit -m "${{ env.MESSAGE }}"
102+
git push
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build and Deploy PDF
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
workflow_dispatch:
8+
9+
env:
10+
ACTIONS_RUNNER_DEBUG: false
11+
# REQUIRES ${{ secrets.GH_ACCESS_TOKEN }} defined in secrets
12+
13+
jobs:
14+
build-deploy-pdf:
15+
uses: kolosovpetro/github-latex-template/.github/workflows/build-and-deploy-pdf-template.yml@main
16+
secrets: inherit
17+
with:
18+
file_name: 'GithubLatexTemplate'
19+
runs_on: 'ubuntu-latest'
20+
workflow_name: 'Build and Deploy PDF'
21+
build_assets_path: |
22+
src/GithubLatexTemplate.tex
23+
src/GithubLatexTemplate.bbl
24+
src/GithubLatexTemplate.bib
25+
src/sections
26+
working_directory_for_latex: 'src'
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: 'Build LaTeX'
2+
on:
3+
workflow_call:
4+
inputs:
5+
file_name:
6+
description: 'LaTeX root file name without extension, example: MyTeXFile'
7+
required: true
8+
type: string
9+
10+
runs_on:
11+
description: 'Agent image'
12+
required: true
13+
type: string
14+
15+
workflow_name:
16+
description: 'Workflow name'
17+
required: true
18+
type: string
19+
20+
build_assets_path:
21+
description: 'Build assets path'
22+
required: true
23+
type: string
24+
25+
working_directory_for_latex:
26+
description: 'Working directory for LaTeX'
27+
required: true
28+
type: string
29+
30+
jobs:
31+
build-pdf:
32+
runs-on: ${{ inputs.runs_on }}
33+
name: ${{ inputs.workflow_name }}
34+
35+
steps:
36+
- name: '🔎 Fetch sources 🔎'
37+
uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
41+
- name: '⬇️ Install GitVersion ⬇️'
42+
uses: gittools/actions/gitversion/setup@v3.0.0
43+
with:
44+
versionSpec: '5.x'
45+
preferLatestVersion: true
46+
47+
- name: '🤔 Determine Version 🤔'
48+
uses: gittools/actions/gitversion/execute@v3.0.0
49+
with:
50+
useConfigFile: true
51+
52+
- name: '📜 Print Version 📜'
53+
run: |
54+
echo "SemVer: ${{ env.GitVersion_SemVer }}"
55+
echo "BranchName: ${{ env.GitVersion_BranchName }}"
56+
echo "ShortSha: ${{ env.GitVersion_ShortSha }}"
57+
newVersion="${{ env.GitVersion_SemVer }}+${{ env.GitVersion_BranchName }}.${{ env.GitVersion_ShortSha }}"
58+
echo "Next version: $newVersion"
59+
60+
- name: '🔄 Update version.tex 🔄'
61+
shell: bash
62+
run: |
63+
newVersion="${{ env.GitVersion_SemVer }}+${{ env.GitVersion_BranchName }}.${{ env.GitVersion_ShortSha }}"
64+
sed -i "s|Local-0.1.0|$newVersion|" "src/sections/version.tex"
65+
66+
- name: '🛠 Build PDF 🛠'
67+
uses: xu-cheng/latex-action@v3
68+
with:
69+
root_file: '${{ inputs.file_name }}.tex'
70+
working_directory: '${{ inputs.working_directory_for_latex }}'
71+
72+
- name: '⬆️ Upload build assets ⬆️'
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: '${{ inputs.file_name }}-${{ env.GitVersion_InformationalVersion }}'
76+
path: '${{ inputs.build_assets_path }}'
77+
78+
- name: '⬆️ Upload artifacts PDF ⬆️'
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: '${{ inputs.file_name }}-PDF-${{ env.GitVersion_InformationalVersion }}'
82+
path: '${{ inputs.working_directory_for_latex}}/${{ inputs.file_name }}.pdf'

.github/workflows/build-pdf.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build PDF
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- master
8+
- main
9+
- release/*
10+
pull_request:
11+
branches:
12+
- main
13+
- master
14+
workflow_dispatch:
15+
16+
env:
17+
ACTIONS_RUNNER_DEBUG: false
18+
19+
jobs:
20+
build-pdf:
21+
uses: kolosovpetro/github-latex-template/.github/workflows/build-pdf-template.yml@main
22+
with:
23+
file_name: 'GithubLatexTemplate'
24+
runs_on: 'ubuntu-latest'
25+
workflow_name: 'Build PDF'
26+
build_assets_path: |
27+
src/GithubLatexTemplate.tex
28+
src/GithubLatexTemplate.bbl
29+
src/GithubLatexTemplate.bib
30+
src/sections
31+
working_directory_for_latex: 'src'

0 commit comments

Comments
 (0)