Skip to content

Commit

Permalink
feat: use Inkscape to make the resume and add a CI to automatically g…
Browse files Browse the repository at this point in the history
…enerate the PDF (#4)
  • Loading branch information
wheelerlaw authored Aug 19, 2022
1 parent 4bcdf85 commit 696b096
Show file tree
Hide file tree
Showing 7 changed files with 1,480 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
template: |
## What’s Changed
$CHANGES
17 changes: 17 additions & 0 deletions .github/scripts/bump_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

if gh release view "$(date --utc +'%y.%m')-1" >&2; then
current_release="$(gh api '/repos/{owner}/{repo}/releases' | jq -r -c 'map(select(.draft == false and .prerelease == false)) | .[0].tag_name')"
current_release_major_minor="$(echo $current_release | sed -e 's/^\(.*\)-.*/\1/')"
current_release_version="$(echo $current_release | sed -e 's/^.*-\(.*\)/\1/')"
>&2 echo "Found existing release for $current_release_major_minor: $current_release"
else
current_release_major_minor="$(date --utc +'%y.%m')"
current_release_version=0
>&2 echo "No release found for $current_release_major_minor"
fi

new_version=$((current_release_version + 1))
new_release="$current_release_major_minor-$new_version"
>&2 echo "New release: $new_release"
echo "$new_release"
83 changes: 83 additions & 0 deletions .github/workflows/pdf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: PDF Generation
concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
on:
push:
branches:
- main
pull_request: {}

jobs:
get-changed-files:
name: Get Changed Files
runs-on: ubuntu-20.04
outputs:
changed-files: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Get list of all changes
uses: tj-actions/changed-files@v26
id: changed-files

build-pdf:
name: Build Resume PDF
runs-on: ubuntu-22.04
needs: [get-changed-files]
if: contains(needs.get-changed-files.outputs.changed-files, 'src/Resume.svg')
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Export resume SVG to PDF
uses: docker://docker.io/minidocks/inkscape
with:
args: src/Resume.svg --export-filename=Resume.pdf
- name: Upload Artifact to Job
uses: actions/upload-artifact@v3
with:
name: Resume.pdf
path: Resume.pdf

publish-pdf:
name: Publish Resume PDF
runs-on: ubuntu-22.04
needs: [build-pdf]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Bump PDF Version
id: bump-version
run: |
new_version="$(./.github/scripts/bump_version.sh)"
echo "::set-output name=new-version::$new_version"
- name: Create Release
uses: release-drafter/release-drafter@v5
id: create-release
with:
tag: ${{ steps.bump-version.outputs.new-version }}
name: ${{ steps.bump-version.outputs.new-version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download Artifact from Previous Job
uses: actions/download-artifact@v3
with:
name: Resume.pdf
- name: Upload Release Asset
run: |
mv Resume.pdf Resume-${{ steps.bump-version.outputs.new-version }}.pdf
until gh release view ${{ steps.bump-version.outputs.new-version }}; do
echo "Release ${{ steps.bump-version.outputs.new-version }} not found. Waiting 1 second until checking again..."
sleep 1
done
gh release upload ${{ steps.bump-version.outputs.new-version }} Resume-${{ steps.bump-version.outputs.new-version }}.pdf
- name: Publish Release
run: gh release edit ${{ steps.bump-version.outputs.new-version }} --draft=false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.idea
auxil
out
*.pdf
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Resume

This version of the resume is made using Inkscape. The source SVG is committed to this repo and a PDF is automatically
generated by the CI system.

When a pull request is opened, the source file is tested by doing a simple build test and
the output of this test (a PDF) is added as an artifact to the build.

When a commit is pushed to `main` (e.g. when a pull request is merged), the PDF is built and uploaded as an asset
to a GitHub release in the repo. The versioning uses a modified [CalVer](https://calver.org/) versioning scheme in the
form of `YY.MM-PATCH`.

![Resume](./src/Resume.svg)
Loading

0 comments on commit 696b096

Please sign in to comment.