Skip to content

JuliaPluto/static-export-template-gitlab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Statically exporting Pluto notebooks in GitLab

This is a demo repository containing one Pluto notebook that is automatically converted to HTML by GitLab CI/CD pipelines, and published to GitLab pages! 🌝

This project is forked from static-export-template and runs GitLab CI/CD pipelines in the mirroring GitLAab repository to export gitlab pages.

More info here: https://www.notion.so/Interactive-web-articles-bf3af6de77854660807e674148c27b1f#1a997e538e0d48e0bf54d2d5f29dfc2b

This project is at its infancy so be careful to use the code in this repository for your own projects.

Cerating a new project using this template

👉 Step 1

Register a GitLab account if you don't have one. Add a new GitLab project by importing this repository: https://github.com/JuliaPluto/static-export-template-gitlab.git or the GitLab mirror https://gitlab.com/sosiristseng/static-export-template-gitlab.git.

image

👉 Step 2

Click on Upload file to upload your .jl notebook files and commit changes.

image

Your notebooks will run on gitlab every time that you add / update the files in this repository. To check the progress, click on CI/CD -> Pipelines, you will find the jobs for the last commit.

image

Wait for the GitLab CI/CD to finish running your notebook and publish the HTML files to GitLab pages. The URL is available in the Settings -> Pages of your repository.

Update notebook files

To update an existing notebook file, simply repeat Step 2 above!

You can also click on the file and then press Replace to update a file that already exists on the repository.

image

Setup in an existing repository

If you already have a GitLab repository with some pluto notebooks in it, you may want to add a web view like the one for your repository. In that case, the steps are slightly different. In this case, I assume that you are familiar with managing a repository. If not, follow the steps above.

👉 Step 1

Make sure that all your Pluto notebooks can be run from a fresh Julia environment. See the tips below about packages.

👉 Step 2

From this repository, download .gitlab-ci.yml and save the file in your own repository root. Commit it to your repository.

Note: The YAML file assumes you are using main as the default branch. Change main to your default branch name in line 28 and 41 if necessary.

The rest is the same as 👉 Step 2 in the previous section.

💡Tips

Environment for the notebooks

Please see 🎁 Package management in Pluto notebooks. (Requires Pluto 0.15+)

Homepage

If you go to the website URL of this repository, you will see a small index of the notebooks in this repository if you don't have a index.html. You can customize this page, two options are:

  • Create your own index.html, it will be used as the homepage.
  • Rename one of your notebooks to index.jl, and it will be the default notebook!