diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e72f2d9..17ab16f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,9 +7,9 @@ on: # Triggers the workflow on push or pull request events but only for the main branch push: branches: [main] - pull_request: - branches: - - main + # pull_request: + # branches: + # - main # Allows you to run this workflow manually from the Actions tab workflow_dispatch: diff --git a/Dockerfile b/Dockerfile index 50f9e27..43c9946 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,10 @@ COPY docs/yarn.lock /yarn.lock RUN yarn --cwd / --modules-folder /app/docs/node_modules install --frozen-lockfile COPY . /app -COPY action.sh /action.sh -RUN chmod +x /action.sh +COPY scripts/build.sh /build.sh +RUN chmod +x /build.sh -ENTRYPOINT [ "/action.sh" ] +ENV ANGELDOCS_MAIN=/app/src/angel-docs/main.py +ENV STATICSITE_MAIN=/app/docs + +ENTRYPOINT [ "/build.sh" ] diff --git a/action.sh b/action.sh deleted file mode 100755 index 0f8296a..0000000 --- a/action.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -l - -# * Project Name: AngelDocs -# * File Name: action.sh -# * Programmer: Kai Prince -# * Date: Mon, Mar 22, 2021 -# * Description: This file contains a github action. - -# ..quit on error -set -e - - -# Run document generator -python /app/src/angel-docs/main.py $@ - -# Run static site builder -yarn --cwd /app/docs build - - -# Copy site to output folder -cp -f -R /app/docs/.vitepress/dist $FOLDER \ No newline at end of file diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..14059de --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,46 @@ +#!/bin/sh -l + +# Project Name: AngelDocs +# File Name: build.sh +# Programmer: Kai Prince +# Date: Tue, Apr 13, 2021 +# Description: This file contains the build script intended for use by CI. + +# ..quit on error +set -e + + +# The main.py file for the main AngelDocs app. +AngelDocsMain="${ANGELDOCS_MAIN:-src/angel-docs/main.py}" + +# The directory containing the 'package.json' file of the static site generator. +StaticSiteMain="${STATICSITE_MAIN:-docs}" + +# The output folder for the finished build. +OutputFolder="${FOLDER:-dist}" + +# The source files to use. +if [[ -z "$@" ]]; then + SourceFiles="src" +else + SourceFiles="$@" +fi + +# Python or Python3 +PythonExecutable="${PYTHON_EXECUTABLE:-python}" + +SourceFiles="src" + + +# Run document generator +echo Running AngelDocs on $SourceFiles +echo python version is +$PythonExecutable --version +$PythonExecutable $AngelDocsMain $SourceFiles + +# Run static site builder +yarn --cwd $StaticSiteMain build + + +# Copy site to output folder +cp -f -R $StaticSiteMain/.vitepress/dist $OutputFolder diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000..5155c37 --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,20 @@ +#!/bin/sh -l + + +# Project Name: AngelDocs +# File Name: install.sh +# Programmer: Kai Prince +# Date: Tue, Apr 13, 2021 +# Description: This file contains the install script intended for use by CI. + +# The location of the requirements.txt file +AngelDocs_requirements=src/angel-docs/requirements.txt + +# The directory containing the 'package.json' file of the static site generator. +StaticSiteMain="${STATICSITE_MAIN:-docs}" + +# Set up python +pip install --no-cache-dir -r $AngelDocs_requirements + +# Set up node +yarn --cwd $StaticSiteMain install --frozen-lockfile \ No newline at end of file