Jan
Jan

Reputation: 935

GitLab Pages deployment step fails after successfull build

I am trying to host a reveal.js presentation via gitlab pages. The repository can be found here: https://gitlab.com/JanGregor/demo-slides

My .gitlab-ci.yml is fairly simple:

image: node:4.2.2

pages:
  cache:
    paths:
    - node_modules/
  script:
  - npm install
  - node_modules/.bin/gulp
  artifacts:
    paths:
    - build
  only:
  - master

After a commit to master though, something goes wrong. The pages task itself is executed and runs just fine. It even shows in the logs that my build directory has been scanned and that the artefacts have been found.

Oddly, the subsequent pages:deploy task fails. It only says :

pages failed to extract

Any help would be greatly appreciated, since I have no clue where to look to next. The documentation itself isn't really helpful when trying to implement an deployment flow with npm.

Thanks in advance folks !

Upvotes: 14

Views: 3986

Answers (3)

1000i100
1000i100

Reputation: 409

Now in 2024 we can publish GitLab-pages in another folder than public.

To do so, in your .gitlab-ci.yml add : publish: dist

A short but working example :

pages:
  script:
    - ls
  artifacts:
    paths:
      - dist
  publish: dist

For more, I found the publish syntax there.

And if you prefer, there are some workaround explained in the official documentation.

Upvotes: 0

brwong
brwong

Reputation: 101

From the GitLab Pages documentation:

To make use of GitLab Pages, the contents of .gitlab-ci.yml must follow the rules below:

  1. A special job named pages must be defined
  2. Any static content which will be served by GitLab Pages must be placed under a public/ directory
  3. artifacts with a path to the public/ directory must be defined

Also mentioned (somewhat tangentially) in the "GitLab Pages from A to Z" guide:

... and GitLab Pages will only consider files in a directory called public.

Upvotes: 10

Jan
Jan

Reputation: 935

Apparently a page can only be published from a folder in under the artifacts that is called "public".

Upvotes: 14

Related Questions