From 3b4b9dc5797ecf7785bccfa7bc4455759d32e16e Mon Sep 17 00:00:00 2001 From: eecavanna Date: Thu, 5 Dec 2024 00:42:47 -0800 Subject: [PATCH] Store source files under `/tmp` to avoid permission issues on GHA --- ...tch-and-compile-workflow-documentation.yml | 10 +++++----- src/workflow_docs/Dockerfile | 9 +++++---- src/workflow_docs/fetch_docs_sources.sh | 20 +++++++++---------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.github/workflows/fetch-and-compile-workflow-documentation.yml b/.github/workflows/fetch-and-compile-workflow-documentation.yml index 635a43d..925ec29 100644 --- a/.github/workflows/fetch-and-compile-workflow-documentation.yml +++ b/.github/workflows/fetch-and-compile-workflow-documentation.yml @@ -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 diff --git a/src/workflow_docs/Dockerfile b/src/workflow_docs/Dockerfile index e341a7f..0e95489 100644 --- a/src/workflow_docs/Dockerfile +++ b/src/workflow_docs/Dockerfile @@ -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. # @@ -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 diff --git a/src/workflow_docs/fetch_docs_sources.sh b/src/workflow_docs/fetch_docs_sources.sh index d1ba3d4..d052204 100644 --- a/src/workflow_docs/fetch_docs_sources.sh +++ b/src/workflow_docs/fetch_docs_sources.sh @@ -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