readme: add template #59
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
name: Build PDF document | ||
on: | ||
push: | ||
branch: | ||
- master | ||
workflow_dispatch: | ||
jobs: | ||
build-pdf: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: check out code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | ||
- name: install python3 | ||
run: | | ||
sudo apt -y update | ||
sudo apt -y install python3 python3-pip | ||
sudo apt -y install gnuplot | ||
- name: install python3 dependencies | ||
run: | | ||
python3 -m pip install -r requirements.txt | ||
- name: setup texlive | ||
uses: teatimeguest/setup-texlive-action@v3 | ||
with: | ||
version: 2024 | ||
packages: | | ||
# to list local packages use: tlmgr info --list --data name | ||
scheme-basic | ||
latexmk | ||
cmap | ||
cancel | ||
tex-gyre | ||
fncychap | ||
float | ||
wrapfig | ||
capt-of | ||
framed | ||
babel-polish | ||
fancyvrb | ||
upquote | ||
needspace | ||
tabulary | ||
varwidth | ||
booktabs | ||
parskip | ||
titlesec | ||
etoolbox | ||
makecell | ||
caption | ||
- name: build PDF | ||
run: make latexpdf | ||
- name: extract file name | ||
run: | | ||
# extract filename from conf.py (it is a value of variable 'project' in lowercase) | ||
echo "filename=$(grep project conf.py | gawk '{gsub(/'\''/,"",$3); print tolower($3)}')" >> $GITHUB_ENV | ||
- name: do some trick ;-) | ||
shell: bash | ||
run: | | ||
echo "The file name is $filename" | ||
stat "_build/latex/${filename}.pdf" | ||
mv "_build/latex/${filename}.pdf" .. | ||
rm -rf * | ||
git add . | ||
git config user.name gucio321 | ||
git config user.email [email protected] | ||
mv ../${filename}.pdf . | ||
git add . | ||
git commit --amend --no-edit | ||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: pdf | ||
force: true | ||
update:url: | ||
Check failure on line 77 in .github/workflows/build.yml GitHub Actions / Build PDF documentInvalid workflow file
|
||
needs: [build-pdf] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: check out code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | ||
- name: extract file name | ||
run: | | ||
# extract filename from conf.py (it is a value of variable 'project' in lowercase) | ||
echo "filename=$(grep project conf.py | gawk '{gsub(/'\''/,"",$3); print tolower($3)}')" >> $GITHUB_ENV | ||
- name: edit README | ||
run: | | ||
# replace content of README.md between <!--AUTOURL-BEGIN--> and <!--AUTOURL-END--> with the link to the PDF file | ||
sed -i -e "/\(<\!--AUTOURL-BEGIN-->\)/, /\(<\!--AUTOURL-END-->\)/c\<\!--AUTOURL-BEGIN-->\n<a href=\"https://github.com/{{ github.repository }}/blob/pdf/{{ github.sha }}/$filename.pdf\">\n<\!--AUTOURL-END-->" README.md | ||
- name: commit | ||
run: | | ||
git config user.name gucio321 | ||
git config user.email [email protected] | ||
git add README.md | ||
git commit -m "Update README.md with the link to the PDF file" | ||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ github.ref }} | ||
force: true | ||