Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing hackage releases

Currently, when I want to update one of my hackage packages, I go through this process.

  1. Push the changes to github
  2. Wait for travis-ci to run on the changes, to ensure I'm not getting any build errors.
  3. Upload to hackage
  4. Tag the release in git.

Naturally, each of these steps I only want to do if the previous step is successful.

I presume other people have a similar workflow, is there something that does all these steps? I could probably do (1), (3) and (4) in a script, although (2) I'm not so sure about (that is, checking the results of travis-ci) but as this seems to be a common problem I was wondering if someone has already solved it so I don't reinvent the wheel.

like image 383
Clinton Avatar asked Oct 30 '22 07:10

Clinton


1 Answers

Travis CI docs make this pretty simple these days, you can follow their docs for deployment to set up conditional deployment (i.e., when a git tag is made). You can configure it to deploy straight to hackage as well, per travis docs.

Here's a semi-complete example config:

deploy:
  provider: hackage
  username: "Hackage User Name"
  password: "Hackage Password"
  on:
    tags: true

Note per Travis docs, "it is recommended to encrypt password. Assuming you have the Travis CI command line client installed, you can do it like this: travis encrypt --add deploy.password". See their docs on encryption for more help on that, since unfortunately I haven't done that part before.

This changes your workflow just a little bit; the end result would be:

  1. Tag and push changes to GitHub
  2. Wait for Travis to test, if all is well, Travis will upload to Hackage for you
  3. If all is not well, fix the bug, and pick a new tag. You may be able to re-use the tag by deleting and re-tagging, but I'm not sure if Travis will accept it

So if you can run any tests locally, be reasonably sure that all is well, you can tag a release and push and Travis will do the rest.

like image 172
Hawkins Avatar answered Nov 15 '22 06:11

Hawkins