Merge pull request #21 from robert-will-brown/fix-workflow #68
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: Produce and Publish PDF | ||
on: # yamllint disable-line rule:truthy | ||
push: | ||
tags: | ||
- 'v*.*' | ||
workflow_dispatch: | ||
jobs: | ||
publish_pdf: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Git repository | ||
uses: actions/checkout@v2 | ||
- name: Get Current Date | ||
id: date | ||
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | ||
- name: Get Githash | ||
id: git_hash | ||
run: echo "::set-output name=git_hash::$(git rev-parse --short "$GITHUB_SHA")" | ||
- name: Get Git Branch | ||
id: git_branch | ||
run: echo "::set-output name=git_branch::${GITHUB_REF#refs/heads/}" | ||
- name: Set Version in Document | ||
uses: jacobtomlinson/gha-find-replace@v2 | ||
with: | ||
find: "@@version@@" | ||
replace: "${{ steps.date.outputs.date }}-${{ steps.git_branch.outputs.git_branch }}-${{ steps.git_hash.outputs.git_hash }}" | ||
regex: false | ||
- name: Retrieve Working Age | ||
id: workingage | ||
run: echo "::set-output name=WORKING_AGE::$(cicd/CalcWorkingLife.sh)" | ||
- name: Set Working Age in Document | ||
uses: jacobtomlinson/gha-find-replace@v2 | ||
with: | ||
find: "@@yearsworking@@" | ||
replace: "${{ steps.workingage.outputs.WORKING_AGE }}" | ||
regex: false | ||
- name: Compile LaTeX Document | ||
uses: xu-cheng/latex-action@v2 | ||
with: | ||
root_file: rb-cv.tex | ||
- name: Install ghostscript | ||
run: sudo apt install ghostscript -y | ||
- name: Workaround ghostscript vunerability protection | ||
# A vunerabillty that existed in ghostscript no longer exists. This is to work around the temporary protection | ||
# that was put in place | ||
# https://stackoverflow.com/questions/52998331/imagemagick-security-policy-pdf-blocking-conversion | ||
run: sudo sed -i 's/rights="none" pattern="PDF"/rights="read | write" pattern="PDF"/' /etc/ImageMagick-6/policy.xml | ||
- name: Generate Thumbnail for Page 1 | ||
#uses: jruipinto/ImageMagick-action@v1 | ||
run: convert -density 700 -resize 10% -append -quality 98 -alpha remove rb-cv.pdf[0] rb-cv-thumbnail-p1.jpg | ||
- name: Generate Thumbnail for Page 2 | ||
uses: jruipinto/ImageMagick-action@v1 | ||
with: | ||
command: convert -density 700 -resize 10% -append -quality 98 -alpha remove rb-cv.pdf[1] rb-cv-thumbnail-p2.jpg | ||
- name: Upload PDF to S3 | ||
id: upload-pdf | ||
uses: hkusu/s3-upload-action@v2 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: 'eu-west-1' | ||
aws-bucket: ${{ secrets.AWS_BUCKET }} | ||
file-path: './rb-cv.pdf' | ||
content-type: 'application/pdf' | ||
destination-dir: '/' | ||
- name: Upload Thumbnail 1 to S3 | ||
uses: hkusu/s3-upload-action@v2 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: 'eu-west-1' | ||
aws-bucket: ${{ secrets.AWS_BUCKET }} | ||
file-path: './rb-cv-thumbnail-p1.jpg' | ||
content-type: 'image/jpeg' | ||
destination-dir: '/' | ||
- name: Upload Thumbnail 2 to S3 | ||
uses: hkusu/s3-upload-action@v2 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: 'eu-west-1' | ||
aws-bucket: ${{ secrets.AWS_BUCKET }} | ||
file-path: './rb-cv-thumbnail-p2.jpg' | ||
content-type: 'image/jpeg' | ||
destination-dir: '/' |