vuejs / vuepress

📝 Minimalistic Vue-powered static site generator
https://vuepress.vuejs.org
MIT License
22.43k stars 4.79k forks source link

Documentation - Github Deployment precision #2372

Open trolologuy opened 4 years ago

trolologuy commented 4 years ago

Bug report

Steps to reproduce

If you follow the steps described on the deployment of vuepress github pages the deployment fails due to some missing details (configuration of .travis.yml file + branching) in the documentation.

What is expected?

The deployment to the github page to be working.

What is actually happening?

There is missing information for the case when you are deploying to your "personal space" (I don't know the proper name of it), for example mine is https://trolologuy.github.io/.

If you are deploying to https://.github.io/, you can omit base as it defaults to "/".

As stated on github in the pages setting page (screenshot below),

'User pages must be built from the master branch.'
That means that the generated static files from docs/.vuepress/dist should be pushed into master.

github-pages-settings

That also means that the target_branch option is missing in the .travis.ymlfile. I added it below commented out:

language: node_js
node_js:
  - lts/*
install:
  - yarn install # npm ci
script:
  - yarn docs:build # npm run docs:build
deploy:
  provider: pages
  target_branch: master
  skip_cleanup: true
  local_dir: docs/.vuepress/dist
  github_token: $GITHUB_TOKEN # A token generated on GitHub allowing Travis to push code on you repository. Set in the Travis settings page of your repository, as a secure variable
  keep_history: true
  on:
    branch: sources

The explanation that could be added on the documentation could be:

If you are deploying to https://.github.io/, you can omit base as it defaults to "/". Be aware that your generated static files have to be present on the master branch of your repository (github pages technical limitation). This could be solved for example by creating a sources branch where you would put the source code of your project. This can be achieved with

git checkout -b sources
git push origin sources

To enable travis to push to the master branch, please uncomment the line # target_branch: master by removing the #.
Final step would be to add the files to your branch (for e.g with git add *) and push your files to the remote branch (git push origin sources).

Other relevant information

Patil2099 commented 3 years ago

If this is still open I would to work on this. Can you guide me on where I have to change the documentation?