Skip to content

Publish PDF release to website #64

Publish PDF release to website

Publish PDF release to website #64

Workflow file for this run

name: Publish PDF release to website
on:
workflow_dispatch:
repository_dispatch:
types: [dispatch_publish]
jobs:
deploy_web:
runs-on: ubuntu-latest
steps:
- name: Get the release
uses: pozetroninc/github-action-get-latest-release@master
id: cv_release
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: "maxpowis/cv"
- name: Echo release tag name
run: echo "::debug::Found tag for LATEST release >> ${{ steps.cv_release.outputs.release }}"
- name: Download all pdf's from release
uses: robinraju/release-downloader@v1.8
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: "maxpowis/cv"
tag: ${{ steps.cv_release.outputs.release }}
out-file-path: "cv"
fileName: '*.pdf'
- name: Checkout github-pages repository
uses: actions/checkout@v2
with:
repository: maxpowis/maxpowis.github.io
token: ${{ secrets.GITHUB_TOKEN }}
path: ./github-pages
- name: Copy pdf files to github-pages
run: |
mkdir -p ./github-pages/assets/cv
rm -f ./github-pages/assets/cv/*
for file in cv/*.pdf; do
echo "Copying $file"
cp -R "$file" ./github-pages/assets/cv/
done
- name: Update redirects for regular pdf
run: |
rm -f ./github-pages/_redirects/cv.html
file=$(find ./cv -type f ! -name "DARK" -print -quit)
cat << EOF > ./github-pages/_redirects/cv.html
---
permalink: /cv
destination: assets/cv/$file
canonical: true
---
EOF
- name: Update redirects for dark pdf
run: |
rm -f ./github-pages/_redirects/cv_dark.html
file=$(find ./cv -type f -name "DARK" -print -quit)
cat << EOF > ./github-pages/_redirects/cv_dark.html
---
permalink: /cv_dark
destination: assets/cv/$file
canonical: true
---
EOF
- name: Commit and push changes github-pages repository
run: |
cd ./github-pages
git add .
git config user.name github-actions
git config user.email github-actions@github.com
git commit -m "Updates from cv release ${{ steps.cv_release.outputs.release }}"
git push