Merge branch 'master' of https://github.com/weilueluo/cv #147
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: Compile Tex to PDF and Generate PNG | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
compile-tex-and-generate-png: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./src | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v2 | |
- name: Install LuaLatex | |
run: | | |
sudo apt update | |
sudo apt-get install texlive-full | |
- name: Compile Resume PDF | |
run: | | |
lualatex resume.tex | |
lualatex resumeCN.tex | |
- name: Install ghostscript | |
run: sudo apt install ghostscript | |
- name: Change ImageMagick policy | |
run: | | |
DQT='"' | |
SRC="rights=${DQT}none${DQT} pattern=${DQT}PDF${DQT}" | |
RPL="rights=${DQT}read\|write${DQT} pattern=${DQT}PDF${DQT}" | |
sudo sed -i "s/$SRC/$RPL/" /etc/ImageMagick-6/policy.xml | |
sudo sed -i '/disable ghostscript format types/,+6d' /etc/ImageMagick-6/policy.xml | |
sudo sed -i -E 's/name="memory" value=".+"/name="memory" value="8GiB"/g' /etc/ImageMagick-6/policy.xml | |
sudo sed -i -E 's/name="map" value=".+"/name="map" value="8GiB"/g' /etc/ImageMagick-6/policy.xml | |
sudo sed -i -E 's/name="area" value=".+"/name="area" value="8GiB"/g' /etc/ImageMagick-6/policy.xml | |
sudo sed -i -E 's/name="disk" value=".+"/name="disk" value="8GiB"/g' /etc/ImageMagick-6/policy.xml | |
- name: Convert PDF to PNG | |
run: | | |
convert -density 900 -background white -alpha off resume.pdf -quality 90 -colorspace RGB resume.png | |
convert -density 900 -background white -alpha off resumeCN.pdf -quality 90 -colorspace RGB resumeCN.png | |
- name: Move Resume PDF | |
run: | | |
mv resume*.pdf .. | |
- name: Commit PNG and PDF | |
id: commit | |
run: | | |
git config --local user.email "action[bot]@github.com" | |
git config --local user.name "github-actions[bot]" | |
git add resume*.png ../resume*.pdf | |
if [-z "$(git status --porcelain)"]; then | |
echo "::set-output name=push::false" | |
else | |
git commit -m "[bot] updated cv pdf and images" | |
git pull | |
echo "::set-output name=push::true" | |
fi | |
shell: bash | |
- name: Push Commit | |
if: steps.commit.outputs.push == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.SECRET_TOKEN }} |