-
Notifications
You must be signed in to change notification settings - Fork 2
58 lines (50 loc) · 1.87 KB
/
extract-images.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
# Extract the coverpages from the pdfs in ./pdf, as images, save then in ./img, so that we can use them as thumbnails in the gallery in 'index.html'.
name: extract_coverpages
on:
push:
paths:
- 'pdf/[0-9]*.pdf'
jobs:
extract-coverpages:
runs-on: ubuntu-latest
steps:
- name: "Checkout project"
uses: actions/checkout@v4
- name: "Set up Python"
uses: actions/setup-python@v5
- name: "Install dependencies"
run: |
echo "Installing and upgrading pip..."
python -m pip install --upgrade pip
echo "installing poppler"
sudo apt-get install poppler-utils
echo "Installing pdf2image..."
pip install pdf2image # For extracting coverpages
- name: "Extract coverpages run python script"
run: python3 extract-thumbnails.py
- name: "Commit and push changes"
run: |
git config --local user.email "x@example.com"
git config --local user.name "GitHub Action"
git add img
git commit -m "[CI/CD] Extract coverpages"
git push
add-new-thumbnails-to-gallery:
needs: extract-coverpages
runs-on: ubuntu-latest
steps:
- name: "Checkout project"
uses: actions/checkout@v4
- name: "Set up Python"
uses: actions/setup-python@v5
- name: "Update index.html with new images."
run: |
echo "Updating index.html with new images."
python3 generate-index.py
- name: "Commit changes"
run: |
git config --local user.email "y@example.com"
git config --local user.name "GitHub Action"
git add index.html
git commit -m "[CI/CD] Update index.html with new images"
git push