Search code examples
travis-cigithub-pageslektor

Error when deploying Lektor site to Github Pages using Travis CI


I've got a Lektor site that I'm trying to deploy automatically in response to pull requests and commits, using the Travis CI trigger approach from the Lektor docs.

The Lektor configuration works fine from the command line.

The Travis build starts, and appears to build the site without problem - but when it gets to deployment, the log says the following:

Installing deploy dependencies
!!! Script support is experimental !!!

Preparing deploy
Cleaning up git repository with `git stash --all`. If you need build artifacts for deployment, set `deploy.skip_cleanup: true`. See https://docs.travis-ci.com/user/deployment/#Uploading-Files.
No local changes to save

Deploying application
Deploying to ghpages-https
  Build cache: /home/travis/.cache/lektor/builds/d3a411e13041731555222b901cff4248
  Target: ghpages+https://pybee/pybee.github.io?cname=pybee.org
  Initialized empty Git repository in /home/travis/build/pybee/pybee.github.io/temp/.deploytemp9xhRDc/scratch/.git/
  Fetching origin
  fatal: repository 'https://github.com/pybee/pybee.github.io/' not found
  error: Could not fetch origin
  fatal: repository 'https://github.com/pybee/pybee.github.io/' not found
Done!

For a full log, see here.

I've checked the credentials in the Travis CI configuration for the repository; I'm as certain as I can be that they're correct. I've tried using the same configuration (exporting LEKTOR_DEPLOY_USERNAME and LEKTOR_DEPLOY_PASSWORD locally), and it works fine.

hammer:pybee.org rkm$ lektor deploy ghpages-https
Deploying to ghpages-https
  Build cache: /Users/rkm/Library/Caches/Lektor/builds/a269cf944d4302f15f78a1dfb1602486
  Target: ghpages+https://pybee/pybee.github.io?cname=pybee.org
  Initialized empty Git repository in /Users/rkm/projects/beeware/pybee.org/temp/.deploytempOh4p98/scratch/.git/
  Fetching origin
  From https://github.com/pybee/pybee.github.io
   * [new branch]      master     -> origin/master
  On branch master
  Your branch is up-to-date with 'origin/master'.
  nothing to commit, working directory clean
  Everything up-to-date
Done!

Any suggestions on the cause of this error?


Solution

  • It turns out this is a bug in Lektor.

    If you use the following in your <project>.lektorproject:

    [servers.ghpages-https]
    target = ghpages+https://pybee/pybee.github.io?cname=pybee.org
    

    and the following in your .travis.yml:

    language: python
    python: 2.7
    cache:
      directories:
        - $HOME/.cache/pip
        - $HOME/.cache/lektor/builds
    install: "pip install git+https://github.com/singingwolfboy/lektor.git@fix-ghpages-https-deploy#egg=lektor"
    script: "lektor build"
    deploy:
      provider: script
      script: "lektor deploy ghpages-https"
      on:
        branch: lektor
    

    (i.e., use the PR branch for deployment), builds will deploy as expected.