Background
I'm maintaining a forked repository that contains a LaTeX project. The README.md contains a .png preview of the .pdf compiled from the example .tex file included in the repo. I often forget to update the .png version using the following ImageMagick command:
magick convert -density 1200 -background white -alpha off Twenty-Seconds-Icons_cv.pdf -quality 90 Twenty-Seconds-Icons_cv.png
Thus I would like to automate this process using GitHub Actions.
Workflow
I think the main.yml file should look something like this, however, I don't fully understand what I am doing.
name: PDF to PNG
on:
push:
branches:
- kaspar
pull_request:
branches:
- kaspar
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install ImageMagick
run: sudo apt install imagemagick # Seems to work and already be included with ubuntu-latest...
- name: Convert PDF to PNG
run: # How?
- name: Commit the updated PNG
run: # How?
Output:
Run sudo apt install imagemagick
sudo apt install imagemagick
shell: /usr/bin/bash -e {0}
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Reading package lists...
Building dependency tree...
Reading state information...
imagemagick is already the newest version (8:6.9.10.23+dfsg-2.1ubuntu11.2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Questions
- It seems like I can just run bash shell commands with
run:; is this true? - How/where can I access the
.pdffile in the repo from inside the GitHub Actions Ubuntu machine? - Where should I save the
.pngfile, is there a~directory? - How can I commit the
.pngfile generated by ImageMagick to the repo? - Would
git commit <file> -m "updated png version of the CV"work?