Skip to content

Deploy Documentation #1

Deploy Documentation

Deploy Documentation #1

Workflow file for this run

name: Deploy Documentation
on:
workflow_dispatch:
inputs:
deploy:
description: "Whether to deploy the website to GitHub Pages"
type: boolean
required: false
default: false
workflow_call:
inputs:
deploy:
description: "Whether to deploy the website to GitHub Pages"
type: boolean
required: false
default: false
# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "docs-deploy-${{ github.ref }}"
cancel-in-progress: true
jobs:
parameters-component:
name: pipeline_parameters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: scilus/sf-tractomics
ref: ${{ github.event.pull_request.head.sha || 'main' }}
fetch-depth: 0 # Shallow clones should be disabled for a version bump to work
- name: Install Nextflow
uses: nf-core/setup-nextflow@v2
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.13"
architecture: "x64"
- name: read .nf-core.yml
uses: pietrobolcato/action-read-yaml@9f13718d61111b69f30ab4ac683e67a56d254e1d # 1.1.0
id: read_yml
with:
config: ${{ github.workspace }}/.nf-core.yml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install nf-core==${{ steps.read_yml.outputs['nf_core_version'] }}
- name: Fetch pipeline parameters
id: pipeline_params
run: |
nf-core pipelines schema docs -o parameters.md -x markdown
echo '' | cat - parameters.md > temp && mv temp parameters.md
echo '---' | cat - parameters.md > temp && mv temp parameters.md
echo 'description: sf-tractomics parameters' | cat - parameters.md > temp && mv temp parameters.md
echo 'title: Pipeline Parameters' | cat - parameters.md > temp && mv temp parameters.md
echo '---' | cat - parameters.md > temp && mv temp parameters.md
sed -E -i 's/^## (.*)$/### **\1**/' parameters.md
sed -E -i '/^# scilus\/sf-tractomics pipeline parameters$/,/^sf-tractomics is a neuroimaging pipeline to process dMRI data\.$/d' parameters.md
- name: Pack into artifacts
uses: actions/upload-artifact@v4
with:
name: markdown
path: parameters.md
build:
needs: parameters-component
runs-on: ubuntu-latest
steps:
- name: Checkout website code
uses: actions/checkout@v4
with:
repository: scilus/sf-tractomics-documentation
- name: Download pipeline parameters
uses: actions/download-artifact@v4
with:
name: markdown
path: src/content/docs/guides/
- name: Install, build, and upload the site
uses: withastro/action@v2
with:
node-version: 22
package-manager: npm@latest
deploy:
if: ${{ inputs.deploy }}
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
# preview-deploy:
# if: ${{ !inputs.deploy && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') }}
# needs: build
# runs-on: ubuntu-latest
# environment:
# name: pr-preview-${{ github.event.pull_request.number }}
# url: ${{ steps.preview.outputs.page_url }}
# steps:
# - name: Deploy PR preview to GitHub Pages
# id: preview
# uses: actions/deploy-pages@v4
# with:
# preview: 'true'
# - name: Comment on PR with preview link
# if: ${{ success() && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# PREVIEW_URL: ${{ steps.preview.outputs.page_url }}
# run: |
# gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
# -f body="🚀 **Documentation preview deployed!**
#
# You can view the live preview here:
# 👉 [${{ env.PREVIEW_URL }}](${{ env.PREVIEW_URL }})
#
# _(This preview will be automatically removed when the PR is closed or merged.)_"