asg017 / os-club-constitution

Constitution for a (future) open source club at UCSD
3 stars 10 forks source link

Automatically generate PDF of constitution whenever updated #29

Open asg017 opened 5 years ago

asg017 commented 5 years ago

I think it would be cool if, whenever the constitution is updated, a PDF of it is automatically generated and placed on GitHub.

I think development of this feature could happen in two steps:

  1. Create a python/javascript/whatever script that converts markdown => PDF

Googling around this seems pretty doable. This isn't exactly automatic - you'd have to run the script manually whenever you change the constitution, but should be straightforward!

The script could work like this, on a high level:

$ python generate_pdf.py
CONSTITUTION.md successfully converted to CONSTITUTION.pdf!
$ ls
CONSTITUTION.md  CONSTITUTION.pdf ....
  1. Automatically run that script on new GitHub release

This one may be a little more complicated, but totally doable!

This repository has releases, meaning that once in a while, we will tag the repository with a version name. For example, we are planning on having v1.0 when the constitution is approved, then after a few updates, it may be updated to v1.1, v1.2, v2.0, etc. We do so so that, if we ever wanted to see what the constitution looked like in the past, we could look up older version of the constitution and see what exactly changed!

Quick aside: Each "release" is created manually. Meaning that there could be multiple commits between two different releases, it just depends whenever the owner of this repository (me) decides to create a "release".

So, we could make it so that whenever a new release is made, we automatically run the script from above and create a file called CONSTITUTION-{version-name}.pdf. For example, CONSTITUTION-v1.0.pdf,CONSTITUTION-v1.2.pdf,CONSTITUTION-v2.0.pdf, etc. We could then upload that pdf into the assets of that release, instead of leaving it inside the codebase.

How do we get notified of a new release? Well, GitHub has this new feature called GitHub Actions, that allows use to run code whenever a specific even happens in a repository. For example, we could run some code whenever someone pushes to our repository, or create a pull request, or opens an issue.

Or, we can run our markdown->PDF script whenever someone creates a new release!

If you're working on this, I definitely recommend looking at GitHub's Actions documentation, and this relevant repository that might be useful!