This file contains hidden or 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: Convert PDF to PNG | |
| on: | |
| push: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v2 | |
| - name: Install Dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt install -y ghostscript imagemagick | |
| - name: Configure ImageMagick | |
| run: | | |
| sudo sed -i 's|<policy domain="resource" name="memory" value="256MiB">|<policy domain="resource" name="memory" value="2GiB">|' /etc/ImageMagick-6/policy.xml | |
| sudo sed -i 's|<policy domain="resource" name="disk" value="1GiB">|<policy domain="resource" name="disk" value="10GiB">|' /etc/ImageMagick-6/policy.xml | |
| sudo mkdir -p /tmp/magick-cache | |
| export MAGICK_TMPDIR=/tmp/magick-cache | |
| echo "Configured ImageMagick policies and cache." | |
| - name: Convert PDF to PNG | |
| run: | | |
| convert -density 300 -background white -alpha off resume.pdf -quality 90 resume.png | |
| - name: Commit PNG | |
| id: commit | |
| run: | | |
| git config --local user.email "action[bot]@github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add resume.png | |
| if [ -z "$(git status --porcelain)" ]; then | |
| echo "::set-output name=push::false" | |
| else | |
| git commit -m "[bot] updated resume.png" | |
| 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 }} |