Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/juliapluto/static-export-template-gitlab

Build pluto notebooks in GitLab CI/CD. https://gitlab.com/sosiristseng/static-export-template-gitlab
https://github.com/juliapluto/static-export-template-gitlab

gitlab-ci julia pluto-notebooks

Last synced: about 1 month ago
JSON representation

Build pluto notebooks in GitLab CI/CD. https://gitlab.com/sosiristseng/static-export-template-gitlab

Awesome Lists containing this project

README

        

# Statically exporting Pluto notebooks in GitLab

This is a demo repository containing one [Pluto](https://github.com/fonsp/Pluto.jl) 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](https://github.com/JuliaPluto/static-export-template) and runs GitLab [CI/CD pipelines](https://gitlab.com/sosiristseng/static-export-template-gitlab/-/pipelines) in the [mirroring GitLAab repository](https://gitlab.com/sosiristseng/static-export-template-gitlab) to export [gitlab pages](https://sosiristseng.gitlab.io/static-export-template-gitlab).

More info here:

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](https://user-images.githubusercontent.com/40054455/123437682-8552b200-d602-11eb-8daa-d7aaeca3eb7e.png)

### πŸ‘‰ Step 2

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

![image](https://user-images.githubusercontent.com/40054455/123435949-b16d3380-d600-11eb-8597-30d324f608b8.png)

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](https://user-images.githubusercontent.com/40054455/123438575-67d21800-d603-11eb-991f-84ee90b6808f.png)

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](https://user-images.githubusercontent.com/40054455/123435720-73700f80-d600-11eb-9c44-7b4ad699a969.png)

## 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`](.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](https://github.com/fonsp/Pluto.jl/wiki/🎁-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!