Publish JSON Resume from GitHub Actions
JSON resume is an open standard for machine (and human) readable CVs. It lets you
represent your CV in the JSON format inside a .json file, and provides a fairly
complete schema to specify what the content inside should look like. This makes it easy
for you to focus on the contents of your CV instead of worrying about formatting.
Additionally, putting your CV in a plaintext file lends itself well to version control
(eg. git).
In the previous guide we described how you can validate the contents of your JSON resume file from within Github Actions. As a follow-up, in this guide, we'll describe how you can publish your JSON resume to txtcv from Github Actions, such that you have a feature complete CI workflow that both validates and publishes your JSON resume.
Prerequisites
This guide assumes that your CV is checked in to a Git repository that is hosted on Github, and that you have an account on txtcv. If you don't already have an account, now would be a good time to sign up (it's free 🙂).
We also assume that you have the txtcv CLI installed on your machine and that you are logged in to txtcv from the command line.
The CLI is easy to install using Homebrew:
$ brew install txtcv/tap/txtcv
Authentication via the CLI works through a personal access token. After signing up for account, visit the access token settings page where you can generate a personal access token for usage together with the CLI.
Run txtcv auth login, paste your token in, and you should be ready to go.
$ txtcv auth login
Please enter your personal access token:
7f041379-a512-4a66-ac63-fcd9c8d1f6e0
Logged in!
Workflow on Local Development
You can use the publish command to publish any file to txtcv. The command expects two
arguments: a --cv-id (the ID of your CV created on txtcv) and a --filename (the
.json file you want to publish). If you don't already have a CV on txtcv, it's easy to
create one by clicking the (very prominent) "Create New CV" button from the dashboard.
The CV ID can then be copied from the URL.
$ txtcv publish --cv-id 1daf4f5c-621b-4ba1-8135-2a8e335b96c7 --filename cv.json
The CV contents have been updated.
If the file was successfully published, the CLI will print out a message accordingly and exit with a status code of 0. If it encountered any errors while publishing, it will tell you exactly what went wrong.
Workflow on Github Actions
The workflow on Github Actions is very similar to the one on the local machine.
We need to instruct Github Actions to install the CLI using brew and then run the
CLI's publish command with the correct arguments. Luckily, Homebrew is available on
the runner machines that Github hosts, which makes the whole workflow definition even
more concise.
We've provided a public workflow definition under
https://github.com/txtcv/actions-publish for publishing CV files, that performs the
steps mentioned above. Here's a sample workflow definition using the action available
from the txtcv/actions-publish repository:
name: Publish CV
on:
push:
branches:
- main
jobs:
publish:
uses: txtcv/actions-publish@main
with:
cv_id: 1daf4f5c-621b-4ba1-8135-2a8e335b96c7
cv_path: cv.json
txtcv_auth_token: ${{ secrets.TXTCV_AUTH_TOKEN }}
Note that the txtcv authentication token is being passed in through a secret, which means you would need to set it as a secret on your Github repository. Feel free to consult Github's detailed documentation on how to do that.
As mentioned earlier, txtcv publish exits non-zero on any errors, in which case this
workflow definition would make the CI red. Feel free to adjust the workflow definition
as per your specific requirements.
Conclusion
In the sections above, we described a fast and lightweight way to publish JSON resume
files, both in local development as well as in Github Actions, using the txtcv CLI. We
hope that this guide was helpful! Happy publishing!