# Project init
As json resume (opens new window) provides a npm packages, let's init a yarn package. A few questions will be asked like name, description, etc. This package will never be published so I can answer almost anything.
yarn init
As always, I like my code to be always formatted, so I set my vscode project to do so.
mkdir -p .vscode
echo '{"editor.formatOnSave": true}' > .vscode/settings.json
Everything but my little girl must be versioned with git, so I init a repo and download a .gitignore for a node project. I also ignore every html and pdf files, as they will be generated when I update my resume
git init
curl -o .gitignore https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
echo '*.html' >> .gitignore
echo '*.pdf' >> .gitignore
Finally, I add to this project the dependency to resume-cli and check if install was successful
yarn add -D resume-cli
./node_modules/.bin/resume --version
Time for a first commit!
git add package.json yarn.lock .vscode .gitignore
git commit -m "init project"
# Json Resume init
Ok so now, it's time to have a resume. For now I will use an example generated by resume-cli until my CI/CD is set
./node_modules/.bin/resume init
resume-cli provides a validate
command, enough at first for a CI, a serve
command, more than enough to have a working dev environment and a export
command perfect for build. I just need to add them to package.json to have user friendly command: yarn dev
and yarn lint
{
"name": "resume",
"version": "1.0.0",
"description": "Bpaulin resume",
"main": "index.js",
"repository": "https://github.com/bpaulin/resume.git",
"author": "Bruno Paulin <brunopaulin@bpaulin.net>",
"license": "MIT",
"private": true,
"devDependencies": {
"resume-cli": "^3.0.7"
},
"scripts": {
"dev": "resume serve",
"lint": "resume validate",
"build": "resume export public/index.html"
}
}
Because I will build my resume to the public
folder, I add a .gitkeep file inside to have it when anyone checkout this repo
mkdir -p public/
touch public/.gitkeep
That's all I need to update my resume, time to let github validate and deploy it... right after a new commit
git add resume.json public/ package.json
git commit -m "init resume"
# CI/CD
I will be the only one to work on my resume (obviously) so I don't need different CI per branch. In fact I will only use main branch so the workflow will only be set on this branch.
About deployment and hosting, I don't need any complicated things. Github pages can host a bunch of static files (html and maybe pdf one day) and as I already host my website with it, my domain is already pointing to gh pages.
About dependencies, I only have resume-cli so I won't even really need to set up a cache. Everything will be downloaded and built each time I update my resume but it will cost me around 1 minutes of gh actions every month at worst... no need to spend time on it for now.
So let's setup pages with only one file
mkdir -p .github/workflows/
touch .github/workflows/cicd.yml
the workflow is really simple and should be self-explanatory
name: Deploy resume
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
# Checkout project
- name: Checkout
uses: actions/checkout@v3
# Single line to download deps, lint and build the resume
- run: yarn && yarn lint && yarn build
# Gh pages init
- name: Setup Pages
uses: actions/configure-pages@v2
# Save public folder, the one who should be published
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "public/"
# Deploy
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
One last commit before writing my own resume and one minute after the push, my resume is online!
git add .github
git commit -m "init deployment"
# Theme
As explained in their doc (opens new window), there is a lot of theme available in npm registry (opens new window). Adding a theme to my resume is a simple yarn dependency.
yarn add -D jsonresume-theme-stackoverflow
To build and serve my resume with this theme, I have to change the scripts in package.json
{
"name": "resume",
"version": "1.0.0",
"description": "Bpaulin resume",
"main": "index.js",
"repository": "https://github.com/bpaulin/resume.git",
"author": "Bruno Paulin <brunopaulin@bpaulin.net>",
"license": "MIT",
"private": true,
"devDependencies": {
"jsonresume-theme-stackoverflow": "^2.0.0",
"resume-cli": "^3.0.7"
},
"scripts": {
"dev": "resume serve --theme stackoverflow",
"lint": "resume validate",
"build": "resume export --theme stackoverflow public/index.html"
}
}
# Conclusion
# Pros
- The data part of my resume is versioned with git and clearly separated from the UI.
- It's hosted with a cool github url without any manual operation.
- It's simple to edit
# Cons
- I have to strictly follow the schema of json resume
- I can't update linkedin with it