From 91e9bf0e494cd1afcb707ddcce06a00dfa7bf266 Mon Sep 17 00:00:00 2001 From: Aleks <152979255+a1eksb@users.noreply.github.com> Date: Fri, 12 Jul 2024 09:39:24 +0200 Subject: [PATCH] [ DOC ]: Add documentation for github deployment --- docs/docs/docs/.pages | 3 +- docs/docs/docs/setup_github.md | 86 ++++++++++++++++++++ docs/docs/docs/{setup.md => setup_gitlab.md} | 6 +- 3 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 docs/docs/docs/setup_github.md rename docs/docs/docs/{setup.md => setup_gitlab.md} (97%) diff --git a/docs/docs/docs/.pages b/docs/docs/docs/.pages index ee14fde..da16d97 100644 --- a/docs/docs/docs/.pages +++ b/docs/docs/docs/.pages @@ -3,4 +3,5 @@ nav: - general.md - advanced.md - visual.md - - setup.md \ No newline at end of file + - setup_gitlab.md + - setup_github.md \ No newline at end of file diff --git a/docs/docs/docs/setup_github.md b/docs/docs/docs/setup_github.md new file mode 100644 index 0000000..7276743 --- /dev/null +++ b/docs/docs/docs/setup_github.md @@ -0,0 +1,86 @@ +--- +title: GitHub Setup +--- + +### Folder Structure +The folder `docs/docs` contains the main content of the docs. + +- assets - contains additional assets such as images. +- stylesheets - contains custom styles +- docs - is a chapter folder and contains additional .md files inside +- index.md - is the main welcome page you see when you visit the docs for the first time + +!!! info + + You can add one or more chapter folders inside of the `docs/docs` folder. Make sure each one of them has an `index.md` file which represents the first page of your chapter. Additioanlly you can add a `.pages` file which includes the order of the pages. + +```yaml title=".pages" linenums="1" +nav: + - index.md + - general.md + - advanced.md + - visual.md + - setup.md +``` + + + +### Adding Your Project + +1. Open `.env` file and add add the project url under the `REPOSITORIES` key and the desired branch under `BRANCHES` key. + + !!! warning + + Make sure the values in the `.env` file are comma separated and there is no spaces in between! + + !!! info + Alternatively ask one of the server admins to add your project to the `.env` file. + +2. Add or expand the `.github/workflows/main.yml` at the root of your project with the following entries: + + ```yaml title="main.yml" linenums="1" + name: Documentation deployment workflow + + on: + push: + paths: + - docs/**/* + pull_request: + paths: + - docs/**/* + + jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install curl + run: sudo apt-get update && sudo apt-get install -y curl + + - name: Deploying the docs + run: | + echo "Deploying the docs" + curl --request POST ${{ secrets.ACINT_URL }} -H "Content-Type: application/json" -d "{\"action\": \"${{ secrets.ACINT_ACTION }}\", \"token\": \"${{ secrets.ACINT_TOKEN }}\"}" + ``` +3. Set the required secrets +3. Copy the `docs` folder at the root of the [docs project](https://github.com/ETH-NEXUS/nexus-docs) into the root of your project. + +4. Expand your `docker-compose.yml` file: + + ```yaml title="docker-compose.yml" linenums="1" + services: + mkdocs: + build: + context: docs + dockerfile: Dockerfile + ports: + - "8000:8000" + volumes: + - ./docs/:/docs/:z + ``` + +That's it! Congratulations you now have your local project documentation! 🥳 Next time you push changes to the `docs` repository your project documentation will be visible in 2-3 minutes on the [docs.nexus.ethz.ch](docs.nexus.ethz.ch) webpage. + diff --git a/docs/docs/docs/setup.md b/docs/docs/docs/setup_gitlab.md similarity index 97% rename from docs/docs/docs/setup.md rename to docs/docs/docs/setup_gitlab.md index 8ce7e96..d51d291 100644 --- a/docs/docs/docs/setup.md +++ b/docs/docs/docs/setup_gitlab.md @@ -1,3 +1,7 @@ +--- +title: Gitlab Setup +--- + ### Folder Structure The folder `docs/docs` contains the main content of the docs. @@ -50,7 +54,7 @@ nav: changes: - "docs/**/*" ``` - +3. Set the required secrets 3. Copy the `docs` folder at the root of the [docs project](https://github.com/ETH-NEXUS/nexus-docs) into the root of your project. 4. Expand your `docker-compose.yml` file: