spencewenski / resume_generator

Render a resume data file into various formats, including pdf, markdown, and plain text. CLI application written in Rust.
MIT License
1 stars 0 forks source link

Resume builder

Install

# Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# LaTeX
## Arch linux
sudo pacman -Sy texlive-core
## Nix env
## Note: This will add texlive globally the current user's env. See the Nix docs for other
## installation methods if this is not desired.
## Note: There are other TexLive packages that may work as well: https://nixos.wiki/wiki/TexLive
nix-env -iA nixpkgs.texlive.combined.scheme-small
## Mac - also may need to add pdflatex to path (located in /Library/TeX/texbin)
brew install --cask basictex
## Ubuntu
sudo apt -y install texlive
# Get the code
git clone --depth 1 https://github.com/spencewenski/resume_generator.git

Running

cargo run -- cargo run -- -i $HOME/Desktop/resume/resume.toml -o resume -d $HOME/Desktop/resume/output

Other helpful usage tips

Create a script or alias to run the tool from any directory. Script version:

#!/bin/sh

cargo run --manifest-path $HOME/projects/resume_generator/Cargo.toml -- -i $HOME/projects/resume/resume.toml -o resume -d $HOME/projects/resume/output "$@"

Regenerate the resume when the config file is updated:

# Install inotify-tools first
## Arch linux
sudo pacman -Sy inotify-tools
# https://superuser.com/questions/181517/how-to-execute-a-command-whenever-a-file-changes
while inotifywait -e close_write resume.toml; do resume; done

Design

Extending / using as a rust library

GitHub Workflows

Build and test

The first workflow that builds the project and runs the test.

Trigger resume render

This workflow runs after the build and test workflow completes. It invokes a repository_dispatch on a separate repository that contains the resume data (this resume repo can be private). In order to use this workflow in a fork of this generator package:

name: Render Resume

Controls when the action will run.

on:

Triggers the workflow on push or pull request events but only for the main branch

push: branches: [ main ] pull_request: branches: [ main ]

Allows you to run this workflow manually from the Actions tab

workflow_dispatch:

Allows other workflows to invoke this workflow

repository_dispatch:

A workflow run is made up of one or more jobs that can run sequentially or in parallel

jobs:

This workflow contains a single job called "build"

build:

The type of runner that the job will run on

runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
  # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
  - name: Checkout resume
    uses: actions/checkout@v2
    with:
      token: ${{ secrets.API_TOKEN }}

  - name: Checkout resume generator
    uses: actions/checkout@v2
    with:
      repository: spencewenski/resume_generator
      path: resume_generator

  - name: Install LaTeX
    run: sudo apt -y install texlive

  - name: Render resume
    working-directory: ./resume_generator
    run: cargo run -- -i ../resume.toml -o resume -d ../output

  - name: Archive rendered resume
    uses: actions/upload-artifact@v2
    with:
      name: resume
      path: output

- You can also update another repo (e.g. your GitHub profile repo) with content generated in the above steps:
```yaml
      # ... continued from the above
      # Replace placeholders, e.g. 'username', with your data
      - name: Checkout profile repo
        uses: actions/checkout@v2
        with:
         repository: username/username
         path: username
         token: ${{ secrets.API_TOKEN }}

      - name: Update profile
        working-directory: ./username
        run: |
          cp ../output/resume-github.md ./README.md
          git -c user.name="Your Name" -c user.email="your.email@example.com" commit -am "Update profile" --author="Your Name"
          git push origin main