forked from hmemcpy/cv
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#24: Deploy pdf's and amend redirects dynamically
- Loading branch information
Showing
1 changed file
with
44 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 |