简体   繁体   中英

Change deploy root on gitlab Pages

I've been creating gitlab pages with the .gitlab-ci.yml template file:

# 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.

The problem: I have a repo where the production files are on dist/ folder.

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:

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

The http-equiv="refresh" will redirect the page to any desired location you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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