Skip to content

Commit

Permalink
#24: Deploy pdf's and amend redirects dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
maxpowis committed Aug 9, 2023
1 parent 1ec66ea commit 714a4ce
Showing 1 changed file with 44 additions and 10 deletions.
54 changes: 44 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,49 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
repository: "maxpowis/cv"
tag: ${{ steps.cv_release.outputs.release }}
out-file-path: "cv"
fileName: '*.pdf'
- name: Publish all pdf's to website
uses: dmnemec/[email protected]
env:
API_TOKEN_GITHUB: ${{ secrets.PERSONAL_TOKEN_REPO_WORKFLOW }}
- name: Checkout github-pages repository
uses: actions/checkout@v2
with:
source_file: '*.pdf'
destination_repo: 'maxpowis/maxpowis.github.io'
destination_branch: 'master'
destination_folder: 'assets'
user_email: '[email protected]'
user_name: 'maxpowis'
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 ./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 ./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 ./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 [email protected]
git commit -m "Updates from cv release ${{ steps.cv_release.outputs.release }}"
git push

0 comments on commit 714a4ce

Please sign in to comment.