Skip to content

Commit

Permalink
Store source files under /tmp to avoid permission issues on GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
eecavanna committed Dec 5, 2024
1 parent 0386f9f commit 3b4b9dc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/fetch-and-compile-workflow-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ jobs:
with: { python-version: '3.12' }
- name: Install dependencies of workflow documentation
run: python -m pip install sphinx sphinx_rtd_theme pillow
# Note: This shell script will store the chapters in `/src/*`.
# Note: This shell script will store the chapters under `/tmp/book/src/`.
- name: Fetch documentation sources and arrange into chapters
run: |
chmod +x ./src/workflow_docs/fetch_docs_sources.sh
./src/workflow_docs/fetch_docs_sources.sh
- name: Introduce additional source documents and a configuration file
run: |
cp src/workflow_docs/overview.rst /src/overview.rst
cp src/workflow_docs/index.rst /src/index.rst
cp src/workflow_docs/conf.py /src/conf.py
cp src/workflow_docs/overview.rst /tmp/book/src/chapters/overview.rst
cp src/workflow_docs/index.rst /tmp/book/src/index.rst
cp src/workflow_docs/conf.py /tmp/book/src/conf.py
- name: Compile source documents into HTML
run: sphinx-build --builder html /src ${{ github.workspace }}/_dist
run: sphinx-build --builder html /tmp/book/src ${{ github.workspace }}/_dist
# Upload the result as an "artifact" so it can then be downloaded and used by another job.
- name: Save the HTML for publishing later # Docs: https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v4
Expand Down
9 changes: 5 additions & 4 deletions src/workflow_docs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ RUN chmod +x /tmp/fetch_docs_sources.sh
RUN /tmp/fetch_docs_sources.sh

# Introduce additional source documents and a configuration file.
COPY overview.rst /src/chapters/overview.rst
COPY index.rst /src/index.rst
COPY conf.py /src/conf.py
# Note: The above shell script will have created `/tmp/book/src/chapters/`.
COPY overview.rst /tmp/book/src/chapters/overview.rst
COPY index.rst /tmp/book/src/index.rst
COPY conf.py /tmp/book/src/conf.py

# Compile source documents into HTML.
#
Expand All @@ -38,7 +39,7 @@ COPY conf.py /src/conf.py
#
# Reference: https://www.sphinx-doc.org/en/master/man/sphinx-build.html
#
RUN sphinx-build --builder html /src /html
RUN sphinx-build --builder html /tmp/book/src /html

EXPOSE 8000

Expand Down
20 changes: 10 additions & 10 deletions src/workflow_docs/fetch_docs_sources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ git clone --no-checkout --depth=1 --single-branch --branch=master --filter=tree:
git clone --no-checkout --depth=1 --single-branch --branch=master --filter=tree:0 https://github.com/microbiomedata/enviroMS /tmp/clones/enviroMS && cd /tmp/clones/enviroMS && git sparse-checkout set --no-cone /docs && git checkout

# Arrange the "docs" directories into chapters.
mkdir -p /src/chapters
mv /tmp/clones/ReadsQC/docs /src/chapters/1_RQC
mv /tmp/clones/ReadbasedAnalysis/docs /src/chapters/2_ReadAnalysis
mv /tmp/clones/metaAssembly/docs /src/chapters/3_MetaGAssembly
mv /tmp/clones/mg_annotation/docs /src/chapters/4_MetaGAnnotation
mv /tmp/clones/metaMAGs/docs /src/chapters/5_MAG
mv /tmp/clones/metaT/docs /src/chapters/6_MetaT
mv /tmp/clones/metaPro/docs /src/chapters/7_Metaproteomics
mv /tmp/clones/metaMS/docs /src/chapters/8_Metabolomics
mv /tmp/clones/enviroMS/docs /src/chapters/9_NOM
mkdir -p /tmp/book/src/chapters
mv /tmp/clones/ReadsQC/docs /tmp/book/src/chapters/1_RQC
mv /tmp/clones/ReadbasedAnalysis/docs /tmp/book/src/chapters/2_ReadAnalysis
mv /tmp/clones/metaAssembly/docs /tmp/book/src/chapters/3_MetaGAssembly
mv /tmp/clones/mg_annotation/docs /tmp/book/src/chapters/4_MetaGAnnotation
mv /tmp/clones/metaMAGs/docs /tmp/book/src/chapters/5_MAG
mv /tmp/clones/metaT/docs /tmp/book/src/chapters/6_MetaT
mv /tmp/clones/metaPro/docs /tmp/book/src/chapters/7_Metaproteomics
mv /tmp/clones/metaMS/docs /tmp/book/src/chapters/8_Metabolomics
mv /tmp/clones/enviroMS/docs /tmp/book/src/chapters/9_NOM

0 comments on commit 3b4b9dc

Please sign in to comment.