简体   繁体   English

更改gitlab页面上的部署根目录

[英]Change deploy root on gitlab Pages

I've been creating gitlab pages with the .gitlab-ci.yml template file: 我一直在使用.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

So far so good, it runs the index.html file on repo root. 到目前为止一切顺利,它在回购根目录下运行index.html文件。

The problem: I have a repo where the production files are on dist/ folder. 问题:我有一个仓库,其中生产文件位于dist/文件夹中。

How do I change the deploy to read the files on that folder instead of reading the root ? 如何更改部署以读取该文件夹上的文件而不是读取根目录?

tree

- /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

You cant do it directly but you can use the following trick/hack: 您不能直接这样做,但可以使用以下技巧/技巧:

html has the following meta tag: html具有以下元标记:

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

commit this as your index.html and it will redirect the index page to any inner file you want inside your local gh-pages branch. 将其提交为index.html,它将索引页重定向到本地gh-pages分支内所需的任何内部文件。

The http-equiv="refresh" will redirect the page to any desired location you want. http-equiv="refresh"会将页面重定向到您想要的任何所需位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM