-
Notifications
You must be signed in to change notification settings - Fork 36
153 lines (146 loc) · 4.86 KB
/
update-files.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Update Files
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}"
cancel-in-progress: true
jobs:
generatetex:
runs-on: ubuntu-latest
strategy:
matrix:
listings: [listings, minted]
steps:
- name: Set up Git repository
uses: actions/checkout@v4
with:
submodules: recursive
ref: '${{ github.event.pull_request.head.ref }}'
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: 'generator-latex-template/package-lock.json'
- name: Make generator available globally
working-directory: ${{ github.workspace }}/generator-latex-template
run: |
npm install
npm link
npm install -g yo
- run: mkdir /tmp/ltg
- name: Generate template
shell: bash
working-directory: /tmp/ltg
run: |
yo $GITHUB_WORKSPACE/generator-latex-template/generators/app/index.js \
--githubpublish\
--docker=iot\
--documentclass=ieee\
--ieeevariant=conference\
--papersize=a4\
--latexcompiler=both\
--bibtextool=bibtex\
--overleaf=true\
--texlive=2024\
--lang=en\
--font=default\
--listings=${{ matrix.listings }}\
--enquotes=csquotes\
--tweakouterquote=babel\
--todo=pdfcomment\
--examples=true\
--howtotext=false
env:
yeoman_test: false
- name: Prepare files
working-directory: /tmp/ltg
run: |
# We update check.yml manually (due to rights management of GitHub and "paper-conference.tex" naming)
rm .github/workflows/check.yml
if [ "${{ matrix.listings }}" == "minted" ]; then
# paper-conference.tex should not be overwritten
mv paper.tex paper-conference-minted.tex
else
mv paper.tex paper-conference.tex
fi
# remove files which should not be overwritten
# _latexmkrc alternates between including and excluding "--shell-escape"; we just want to keep the minted + en version of it
if [ "${{ matrix.listings }}" != "minted" ]; then
rm _latexmkrc
rm -r .github/workflows
fi
# the LICENSE of the repository should be kept
rm LICENSE
# Files are ready
# Overwrite old versions in $GITHUB_WORKSPACE
cp -r * $GITHUB_WORKSPACE
cp -r .* $GITHUB_WORKSPACE
# output current status
cd ${{ github.workspace }}
git status
git diff
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
message: 'Update files based on generated files by template generator'
author_name: 'github-actions[bot]'
author_email: 'github-actions[bot]@users.noreply.github.com'
push: false
- name: Push changes
run: |
parallel --retries 10 --delay 9 ::: "git pull --rebase; git push"
publish:
runs-on: ubuntu-latest
needs: [generatetex]
steps:
- name: Set up Git repository
uses: actions/checkout@v4
with:
ref: '${{ github.event.pull_request.head.ref }}'
- run: |
# use latexmkrc (which is disabled due to easy overleaf usage)
cp _latexmkrc latexmkrc
- name: Install TeX Live
uses: zauguin/install-texlive@v3
with:
package_file: '${{ github.workspace }}/Texlivefile'
- name: Prepare latexmk
run: |
updmap -sys
texhash
tlmgr generate language --rebuild-sys
- name: Build all examples
run: |
for doc in paper*.tex; do
latexmk "$doc"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "## $doc" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
texlogsieve < "${doc%.tex}.log" >> "$GITHUB_STEP_SUMMARY" || true
echo '```' >> "$GITHUB_STEP_SUMMARY"
done
- run: |
mkdir publish
cp *.pdf publish/
cp paper-conference.tex publish/
cp README.md publish/
cp .github/_config.yml publish/
- uses: actions/upload-artifact@v4
with:
name: publish
path: publish/
- name: Deploy
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./publish
enable_jekyll: true
force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'