jupyter-book / mystmd

Command line tools for working with MyST Markdown.
https://mystmd.org/guide
MIT License
219 stars 64 forks source link

Deployment on GitLab #505

Open corentinmorice1 opened 1 year ago

corentinmorice1 commented 1 year ago

The new GitHub pages deployment works like a charm, thanks a lot! Now I'm trying to deploy my website on GitLab instead. I made a naive .gitlab-ci.yml (following the GitHub deploy.yml), but it crashes after myst build runs. Would anyone have experience with this?

image: condaforge/mambaforge:latest

variables:
  BASE_URL: "/myst-test"

cache:
  paths:
    - .cache/pip

stages:
  - pages

before_script:
    - python -V               # Print out python version for debugging

pages:
  stage: pages
  script:
    - mamba install -y -c conda-forge nodejs
    - node -v
    - npm install -g mystmd
    - myst build --html
    - mv _build/html/ public/
  artifacts:
    paths:
      - public
  only:
    - master
welcome[bot] commented 1 year ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

rowanc1 commented 1 year ago

Glad that the github pages worked easily. :)

Can you post what the error is on gitlab? I haven't ever used gitlab actions, but it should be very similar!

At that stage of the build, a template is downloaded, a server is started for the build, and then local web requests are sent to the server. I would imagine that all of that is allowed in the Git lab runner. I can't see anything obvious in the yaml you posted!

corentinmorice1 commented 1 year ago

Sorry about this, the solution was actually very simple. Here was the error:

The table of contents defined in "_toc.yml" could not find file "index" defined as the "root:" page. Please ensure that one of these files is defined:
- index.md
- index.ipynb
- index.tex
Cleaning up project directory and file based variables 00:01
ERROR: Job failed: exit code 1

And the solution was simply to remove the file _toc.yml. It works really nicely now, as you can see at: https://corentin.morice.gitlab.dsi.universite-paris-saclay.fr/myst-test/notebook. Thanks a lot for all the help! Please feel free to use the .gitlab-ci.yml file above if it can be of any use!