Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating (HTML/PDF) assets for Hugo site with Gitlab CI

I've created a Gitlab CI job to use pandoc to create some HTML and PDF assets that I would like to deploy to my Hugo site hosted with Gitlab Pages.

In .gitlab-ci.yml my job looks like this:

# All available Hugo versions are listed here: https://gitlab.com/pages/hugo/container_registry

stages:
  - test
  - deploy
  - build

variables:
  GIT_SUBMODULE_STRATEGY: recursive

test:
  image: registry.gitlab.com/pages/hugo:latest
  stage: test
  script:
  - hugo
  except:
  - master

assets:
  stage: build
  image:
    name: pandoc/latex:2.6
    entrypoint: ["/bin/sh", "-c"]
  before_script:
    - apk add bash
    - apk add zip
    - chmod +x ci-build.sh
  script:
    - ./ci-build.sh
  artifacts:
    paths:
    - public

pages:
  image: registry.gitlab.com/pages/hugo:latest
  stage: deploy
  script:
  - hugo
  artifacts:
    paths:
    - public
  only:
  - master

However, the assets generated by this job do not seem to be deployed to my site as I get a 404 when trying to access them.

I have tried setting an artifacts path, but get this error:

artifacts:
    paths:
    - public
Uploading artifacts...
public: found 369 matching files                   
Uploading artifacts to coordinator... ok            id=281690834 responseStatus=201 Created token=56oqTg7A
Job succeeded

You can find my repo here and my site here if that helps!

I'd really like to figure this out so that I don't have to track the assets in Git. Any help would be most appreciated!

like image 965
Finn LeSueur Avatar asked Aug 23 '19 12:08

Finn LeSueur


1 Answers

I have tested your gitlab ci configuration. It works for me.
It only takes about 35 minutes for the page to become visible.

Please check if the assets job does not overwrite the pages job.

After the pipeline has finished successfully, wait approximately 30 minutes for your website to be visible. See here

like image 59
pb11pb Avatar answered Oct 15 '22 18:10

pb11pb