Skip to content

Commit

Permalink
Merge pull request #7 from kolosovpetro/updates
Browse files Browse the repository at this point in the history
Release/v1.0.0
  • Loading branch information
kolosovpetro authored Dec 8, 2024
2 parents 82bdcbd + 1f5595a commit 2cd9db8
Show file tree
Hide file tree
Showing 32 changed files with 712 additions and 232 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf

[*.{xml,yml,yaml}]
indent_size = 2
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* text=auto eol=lf
*.cs linguist-detectable=true
*.js linguist-detectable=false
*.cshtml linguist-detectable=false
Expand Down
102 changes: 102 additions & 0 deletions .github/workflows/build-and-deploy-pdf-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: 'Build and Deploy LaTeX'
on:
workflow_call:
inputs:
file_name:
description: 'LaTeX root file name without extension, example: MyTeXFile'
required: true
type: string

runs_on:
description: 'Agent image'
required: true
type: string

workflow_name:
description: 'Workflow name'
required: true
type: string

build_assets_path:
description: 'Build assets path'
required: true
type: string

working_directory_for_latex:
description: 'Working directory for LaTeX'
required: true
type: string

env:
TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
USERNAME: "kolosovpetro"
EMAIL: "kolosovp94@gmail.com"
MESSAGE: "CICD deploy of ${{ inputs.file_name }} PDF document"

jobs:
build-pdf:
runs-on: ${{ inputs.runs_on }}
name: ${{ inputs.workflow_name }}

steps:
- name: '🔎 Fetch sources 🔎'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: '⬇️ Install GitVersion ⬇️'
uses: gittools/actions/gitversion/setup@v3.0.0
with:
versionSpec: '5.x'
preferLatestVersion: true

- name: '🤔 Determine Version 🤔'
uses: gittools/actions/gitversion/execute@v3.0.0
with:
useConfigFile: true

- name: '📜 Print Version 📜'
run: |
echo "SemVer: ${{ env.GitVersion_SemVer }}"
echo "BranchName: ${{ env.GitVersion_BranchName }}"
echo "ShortSha: ${{ env.GitVersion_ShortSha }}"
newVersion="${{ env.GitVersion_SemVer }}+${{ env.GitVersion_BranchName }}.${{ env.GitVersion_ShortSha }}"
echo "Next version: $newVersion"
- name: '🔄 Update version.tex 🔄'
shell: bash
run: |
newVersion="${{ env.GitVersion_SemVer }}+${{ env.GitVersion_BranchName }}.${{ env.GitVersion_ShortSha }}"
sed -i "s|Local-0.1.0|$newVersion|" "src/sections/version.tex"
- name: '🛠 Build PDF 🛠'
uses: xu-cheng/latex-action@v3
with:
root_file: '${{ inputs.file_name }}.tex'
working_directory: '${{ inputs.working_directory_for_latex }}'

- name: '⬆️ Upload build assets ⬆️'
uses: actions/upload-artifact@v4
with:
name: '${{ inputs.file_name }}-${{ env.GitVersion_InformationalVersion }}'
path: '${{ inputs.build_assets_path }}'

- name: '⬆️ Upload artifacts PDF ⬆️'
uses: actions/upload-artifact@v4
with:
name: '${{ inputs.file_name }}-PDF-${{ env.GitVersion_InformationalVersion }}'
path: '${{ inputs.working_directory_for_latex}}/${{ inputs.file_name }}.pdf'

- name: '📀 Clone repository 📀'
run: |
git clone https://${{ env.TOKEN }}@github.com/kolosovpetro/kolosovpetro.github.io.git ~/kolosovpetro.github.io
cp src/${{ inputs.file_name }}.pdf ~/kolosovpetro.github.io/pdf/${{ inputs.file_name }}.pdf
- name: '❇️ Commit changes ❇️'
run: |
cd ~/kolosovpetro.github.io
git config --global user.name "${{ env.USERNAME }}"
git config --global user.email "${{ env.EMAIL }}"
git add .
git commit -m "${{ env.MESSAGE }}"
git push
54 changes: 21 additions & 33 deletions .github/workflows/build-and-deploy-pdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,26 @@ name: Build and Deploy PDF

on:
push:
branches:
- master
tags:
- v*
workflow_dispatch:

env:
ACTIONS_RUNNER_DEBUG: false
# REQUIRES ${{ secrets.GH_ACCESS_TOKEN }} defined in secrets

jobs:
build-resume:
runs-on: ubuntu-latest
name: Create document
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Convert to pdf
id: convert-to-pdf
uses: xu-cheng/latex-action@v2
with:
root_file: RSAEncryptionExplained.tex
working_directory: src
- uses: actions/upload-artifact@v2
with:
name: PDF
path: RSAEncryptionExplained.pdf
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Clone repository and add document
run: |
git clone https://${{ secrets.GH_ACCESS_TOKEN }}@github.com/kolosovpetro/kolosovpetro.github.io.git ~/kolosovpetro.github.io
cp out/RSAEncryptionExplained.pdf ~/kolosovpetro.github.io/pdf/RSAEncryptionExplained.pdf
- name: Commit document changes if any
run: |
cd ~/kolosovpetro.github.io
git config --global user.name '${{ secrets.GH_NAME }}'
git config --global user.email '${{ secrets.GH_EMAIL }}'
git add .
git commit -am "CICD deploy from main repo"
git push
build-deploy-pdf:
uses: kolosovpetro/github-latex-template/.github/workflows/build-and-deploy-pdf-template.yml@main
secrets: inherit
with:
file_name: 'RSAEncryptionExplained'
runs_on: 'ubuntu-latest'
workflow_name: 'Build and Deploy PDF'
build_assets_path: |
src/RSAEncryptionExplained.tex
src/RSAEncryptionExplained.bbl
src/RSAEncryptionExplained.bib
src/sections
src/img
working_directory_for_latex: 'src'
82 changes: 82 additions & 0 deletions .github/workflows/build-pdf-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: 'Build LaTeX'
on:
workflow_call:
inputs:
file_name:
description: 'LaTeX root file name without extension, example: MyTeXFile'
required: true
type: string

runs_on:
description: 'Agent image'
required: true
type: string

workflow_name:
description: 'Workflow name'
required: true
type: string

build_assets_path:
description: 'Build assets path'
required: true
type: string

working_directory_for_latex:
description: 'Working directory for LaTeX'
required: true
type: string

jobs:
build-pdf:
runs-on: ${{ inputs.runs_on }}
name: ${{ inputs.workflow_name }}

steps:
- name: '🔎 Fetch sources 🔎'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: '⬇️ Install GitVersion ⬇️'
uses: gittools/actions/gitversion/setup@v3.0.0
with:
versionSpec: '5.x'
preferLatestVersion: true

- name: '🤔 Determine Version 🤔'
uses: gittools/actions/gitversion/execute@v3.0.0
with:
useConfigFile: true

- name: '📜 Print Version 📜'
run: |
echo "SemVer: ${{ env.GitVersion_SemVer }}"
echo "BranchName: ${{ env.GitVersion_BranchName }}"
echo "ShortSha: ${{ env.GitVersion_ShortSha }}"
newVersion="${{ env.GitVersion_SemVer }}+${{ env.GitVersion_BranchName }}.${{ env.GitVersion_ShortSha }}"
echo "Next version: $newVersion"
- name: '🔄 Update version.tex 🔄'
shell: bash
run: |
newVersion="${{ env.GitVersion_SemVer }}+${{ env.GitVersion_BranchName }}.${{ env.GitVersion_ShortSha }}"
sed -i "s|Local-0.1.0|$newVersion|" "src/sections/version.tex"
- name: '🛠 Build PDF 🛠'
uses: xu-cheng/latex-action@v3
with:
root_file: '${{ inputs.file_name }}.tex'
working_directory: '${{ inputs.working_directory_for_latex }}'

- name: '⬆️ Upload build assets ⬆️'
uses: actions/upload-artifact@v4
with:
name: '${{ inputs.file_name }}-${{ env.GitVersion_InformationalVersion }}'
path: '${{ inputs.build_assets_path }}'

- name: '⬆️ Upload artifacts PDF ⬆️'
uses: actions/upload-artifact@v4
with:
name: '${{ inputs.file_name }}-PDF-${{ env.GitVersion_InformationalVersion }}'
path: '${{ inputs.working_directory_for_latex}}/${{ inputs.file_name }}.pdf'
39 changes: 22 additions & 17 deletions .github/workflows/build-pdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,29 @@ on:
push:
branches:
- develop
- master
- main
- release/*
pull_request:
branches:
- develop
- main
- master
workflow_dispatch:

env:
ACTIONS_RUNNER_DEBUG: false

jobs:
build-resume:
runs-on: ubuntu-latest
name: Create document
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Convert to pdf
id: convert-to-pdf
uses: xu-cheng/latex-action@v2
with:
root_file: RSAEncryptionExplained.tex
working_directory: src
- uses: actions/upload-artifact@v2
with:
name: PDF
path: RSAEncryptionExplained.pdf
build-pdf:
uses: kolosovpetro/github-latex-template/.github/workflows/build-pdf-template.yml@main
with:
file_name: 'RSAEncryptionExplained'
runs_on: 'ubuntu-latest'
workflow_name: 'Build PDF'
build_assets_path: |
src/RSAEncryptionExplained.tex
src/RSAEncryptionExplained.bbl
src/RSAEncryptionExplained.bib
src/sections
src/img
working_directory_for_latex: 'src'
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
## Generated if empty string is given at "Please type another file name for output:"
.idea/
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
#*.bbl
#*.bcf
#*.blg
*-blx.aux
*-blx.bib
*.run.xml
Expand Down Expand Up @@ -289,4 +289,4 @@ TSWLatexianTemp*
# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
# Uncomment the next line to have this generated file ignored.
#*Notes.bib
#*Notes.bib
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec/v2.0.0.html).

## [1.0.0] - 2024-12-08

### Changed

- Update CI/CD
- Add editor config
- Add GitVersion config
- Update readme
- Add build scripts
- Fix PDF images warnings
- Move sections to separate files
- Add document versioning
- Update metadata
1 change: 1 addition & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mode: Mainline
Loading

0 comments on commit 2cd9db8

Please sign in to comment.