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

2

8

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!

Xylography answered 23/8, 2019 at 12:39 Comment(0)
N
5

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

Nougat answered 4/9, 2019 at 11:39 Comment(0)
L
-1

Is "public" a folder? If so, try to put a backslash after it:

artifacts:
  paths:
    - public/
Langill answered 23/8, 2019 at 13:22 Comment(1)
Hi @cecunamo! Thank you for your response. I have tried that with “public/“ and “builds/“ and both return the same error response.Xylography

© 2022 - 2024 — McMap. All rights reserved.