Skip to content

Commit

Permalink
WIP: Scripts to build Nextflow docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ewels committed Mar 14, 2024
1 parent bc081db commit 829f910
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ stuff/
.DS_Store
.gitpod.yml

# For docs build
nextflow/

# build output
dist/

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ There are also a bunch of `npm` commands for more fine-grained control:

</details>

Note that `make build` / `npm run build` fetch the Nextflow repo and build the docs automatically.
When running `make dev` / `npm run dev` this doesn't happen, so the docs will not be visible.

## Code formatting

Code syntax is enforced using [Prettier](https://prettier.io/). You can use a plugin in your code editor to run this automatically on save and it also runs as a CI check on push and pull-requests.
Expand Down
37 changes: 37 additions & 0 deletions build_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

#####################################################################
# NEXTFLOW DOCUMENTATION
#####################################################################

WEBSITE_DIR=$(pwd)

# Make the empty target directories
mkdir -p output/docs/latest/
mkdir -p output/docs/edge/

# Fetch the Nextflow repo
git clone https://github.com/nextflow-io/nextflow.git
cd nextflow/docs/

# Find the latest stable and edge releases
STABLE_TAG=$(curl -s https://api.github.com/repos/nextflow-io/nextflow/releases | jq -r ". [].tag_name" | grep -v edge | head -n 1)
EDGE_TAG=$(curl -s https://api.github.com/repos/nextflow-io/nextflow/releases | jq -r ". [].tag_name" | grep edge | head -n 1)
echo "Latest stable release: $STABLE_TAG"
echo "Latest edge release: $EDGE_TAG"

# Sanity check: Assert string lengths
if [ ${#STABLE_TAG} -le 4 ]; then echo "Version string too short" ; exit 1; fi
if [ ${#EDGE_TAG} -le 4 ]; then echo "Version string too short" ; exit 1; fi

# Build edge docs
git checkout $EDGE_TAG
pip install -r requirements.txt
make clean html
mv _build/html/* $WEBSITE_DIR/output/docs/edge/

# Build stable docs
git checkout $STABLE_TAG
pip install -r requirements.txt
make clean html
mv _build/html/* $WEBSITE_DIR/output/docs/latest/
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"docs": "bash build_docs.sh",
"build": "astro check && astro build && bash build_docs.sh",
"preview": "astro preview",
"astro": "astro"
},
Expand Down

0 comments on commit 829f910

Please sign in to comment.