1

我一直在使用.gitlab-ci.yml模板文件创建 gitlab 页面:

# This file is a template, and might need editing before it works on your project.
# Full project: https://gitlab.com/user/project
pages:
  stage: deploy
  script:
  - mkdir .public
  - cp -r * .public
  - mv .public public
  artifacts:
    paths:
    - public
  only:
  - master

到目前为止一切顺利,它在 repo root 上运行 index.html 文件。

问题:我有一个存储库,其中生产文件位于dist/文件夹中。

如何更改部署以读取该文件夹上的文件而不是读取根目录?

- /src
- /dist 
---- index.html ---> i want to set this as root
---- assets/ 
.gitignore
README.md
gulpfile.js
package.json

----> gitlab is trying to find index.html on the root
4

1 回答 1

2

你不能直接这样做,但你可以使用以下技巧/黑客:

html具有以下元标记:

<meta http-equiv="refresh" content="0;url=http://repo.github.io/folder/index.html" />

将此作为您的 index.html 提交,它会将索引页面重定向到您想要在本地gh-pages分支中的任何内部文件。

http-equiv="refresh"会将页面重定向到您想要的任何所需位置。

于 2017-01-14T19:59:11.967 回答