8

我创建了一个 Gitlab CI 作业,用于pandoc创建一些我想部署到使用 Gitlab Pages 托管的 Hugo 站点的 HTML 和 PDF 资产。

.gitlab-ci.yml我的工作中是这样的:

# 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

但是,此作业生成的资产似乎没有部署到我的站点,因为我在尝试访问它们时收到 404。

我尝试设置工件路径,但收到此错误:

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

如果有帮助,你可以在这里找到我的仓库我的网站

我真的很想弄清楚这一点,这样我就不必在 Git 中跟踪资产。非常感激任何的帮助!

4

2 回答 2

5

我已经测试了你的 gitlab ci 配置。这个对我有用。
页面显示只需大约 35 分钟。

请检查资产作业是否不会覆盖页面作业。

管道成功完成后,等待大约 30 分钟让您的网站可见。看这里

于 2019-09-04T11:39:49.160 回答
-1

public ”是一个文件夹吗?如果是这样,请尝试在其后加上反斜杠:

artifacts:
  paths:
    - public/
于 2019-08-23T13:22:43.203 回答