-
Notifications
You must be signed in to change notification settings - Fork 3
42 lines (35 loc) · 1.19 KB
/
main.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
name: Selectively Update and Commit Zipped Templates
on:
push:
branches:
- main # Triggers on pushes to the main branch
jobs:
update_zips:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Setup Environment
run: sudo apt-get update && sudo apt-get install -y zip make texlive-full
- name: Determine Changed Directories
id: changed_dirs
run: |
git diff --name-only HEAD^ HEAD | grep '^.*\/' | xargs -L1 dirname | sort -u > changed_dirs.txt
echo "changed_dirs=$(cat changed_dirs.txt)" >> $GITHUB_ENV
- name: Compile and Zip Changed Templates
run: |
while read dir; do
if [ -d "$dir" ] && [ -f "$dir/Makefile" ]; then
(cd "$dir" && make zip")
git add "*.zip"
fi
done < changed_dirs.txt
- name: Commit and Push Changes
if: env.changed_dirs != ''
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "(feat) Automatically update zipped templates based on recent changes."
git push