Superbest
Superbest

Reputation: 26612

How to automate Harp deployment?

I compile my website into static HTML using Harp. I then upload the static HTML to my webserver's data directory to deploy the build. I store the markdown source in a private GitLab repository (hosted by me).

All the uploading and mucking about with Harp is a little tedious and I'd like to automate it. I would like to set things up so that as soon as I push a new commit to the GitLab repo, Harp automatically compiles and copies over the HTML files.

How can I accomplish this?

The webserver and GitLab hosts are actually both virtual hosts on the same Ubuntu machine, and I use the machine itself to run harp compile.

Upvotes: 1

Views: 208

Answers (1)

kennethormandy
kennethormandy

Reputation: 2150

We do this on the harpjs.com website repo: when a commit is pushed or a pull request merged, harp compile is run on Travis CI and then we publish the static files to Surge.sh.

.travis.yml

language: node_js
sudo: false
node_js:
  - "4.0"
after_success:
  - npm run deploy

package.json run scripts

  "scripts": {
    "compile": "harp compile",
    "deploy": "npm run compile && surge ./www harpjs.com"
  }

Full disclosure, I am on the Harp team and we also make Surge, but I think that example in the .travis.yml file of the harpjs.com repo should still be applicable, even if you’re using GitLab and something other than Surge.

Upvotes: 1

Related Questions