Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload generated RST files after docs-build #39

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/_shared-docs-build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ on:
required: false
type: string
default: ${{ github.event.repository.name }}_docs_${{ github.event.pull_request.head.sha }}
rst-artifact-name:
description: The name of the RST artifact to upload.
required: false
type: string
default: ${{ github.event.repository.name }}_rst_${{ github.event.pull_request.head.sha }}
diff-size-limit:
description: The max size of the diff, past which it will be truncated.
required: false
Expand Down Expand Up @@ -223,6 +228,7 @@ jobs:
build-html: ${{ steps.init-base.outputs.build-html }}
copy-build: ${{ github.workspace }}/docsbuild/base
artifact-upload: 'false'
rst-artifact-upload: 'false'

- name: Checkout HEAD
uses: actions/checkout@v3
Expand Down Expand Up @@ -253,8 +259,11 @@ jobs:
with:
build-script: ${{ steps.init-head.outputs.build-script }}
build-html: ${{ steps.init-head.outputs.build-html }}
build-rst: ${{ steps.init-head.outputs.build-rst }}
copy-build: ${{ github.workspace }}/docsbuild/head
copy-rst: ${{ github.workspace }}/rst
artifact-name: ${{ inputs.artifact-name }}
rst-artifact-name: ${{ inputs.rst-artifact-name }}

- name: Get a diff of the changes
if: steps.build-base.outputs.hash != steps.build-head.outputs.hash
Expand Down
40 changes: 39 additions & 1 deletion actions/ansible-docs-build-html/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,38 @@ inputs:
description: The path where the build script will output the HTML.
required: false
default: ${{ runner.temp }}/docsbuild/build/html
build-rst:
description: The path where the build script will output the RST.
required: false
default: ${{ runner.temp }}/docsbuild/rst
copy-build:
description: |
If set, copy the built HTML files to this path after building, and set the build-html output to this path instead.
This is useful if you need to do multiple builds from the same environment, or otherwise need the files to be elsewhere.
Note: files in the destination that do not exist in the source will be deleted!
required: false
copy-rst:
description: |
If set, copy the preprocessed RST files to this path after building, and set the build-rst output to this path instead.
This is useful if you need to do multiple builds from the same environment, or otherwise need the files to be elsewhere.
Note: files in the destination that do not exist in the source will be deleted!
required: false
artifact-upload:
description: If true then upload the rendered docs as a build artifact.
required: false
default: 'true'
rst-artifact-upload:
description: If true then upload the rendered docs as a build artifact.
required: false
default: 'true'
artifact-name:
description: The name of the build artifact.
required: false
default: ${{ github.event.repository.name }}_docs
rst-artifact-name:
description: The name of the RST artifact.
required: false
default: ${{ github.event.repository.name }}_rst
artifact-retention-days:
description: Number of days to keep the artifact.
required: false
Expand Down Expand Up @@ -53,7 +71,9 @@ runs:
echo "::endgroup::"

HTML="${{ inputs.build-html }}"
RST="${{ inputs.build-rst }}"
COPY_BUILD="${{ inputs.copy-build }}"
COPY_RST="${{ inputs.copy-rst }}"

if [[ "$COPY_BUILD" != "" ]] ; then
echo "::group::Copy the build files"
Expand All @@ -65,14 +85,32 @@ runs:
echo "::set-output name=build-html::$HTML"
fi

- name: Upload artifact
if [[ "$COPY_RST" != "" ]] ; then
echo "::group::Copy the pre-processed files"
mkdir -p "$COPY_RST"
rsync -avc --delete-after "$RST/" "$COPY_RST/"
echo "::set-output name=build-rst::$COPY_RST"
echo "::endgroup::"
else
echo "::set-output name=build-rst::$RST"
fi

- name: Upload HTML artifact
if: fromJSON(inputs.artifact-upload)
uses: actions/upload-artifact@v3
with:
path: ${{ steps.build.outputs.build-html }}
name: ${{ inputs.artifact-name }}
retention-days: ${{ fromJSON(inputs.artifact-retention-days) }}

- name: Upload RST artifact
if: fromJSON(inputs.rst-artifact-upload)
uses: actions/upload-artifact@v3
with:
path: ${{ steps.build.outputs.build-rst }}
name: ${{ inputs.rst-artifact-name }}
retention-days: ${{ fromJSON(inputs.artifact-retention-days) }}

- name: Output step
id: outs
shell: bash
Expand Down
4 changes: 4 additions & 0 deletions actions/ansible-docs-build-init/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ outputs:
build-html:
description: The path of the build's html output directory.
value: ${{ steps.init.outputs.build-html }}
build-rst:
description: The path of the build's RST output directory.
value: ${{ steps.init.outputs.build-rst }}

runs:
using: composite
Expand Down Expand Up @@ -77,4 +80,5 @@ runs:
echo "::endgroup::"

echo "::set-output name=build-script::${{ inputs.dest-dir }}/build.sh"
echo "::set-output name=build-rst::${{ inputs.dest-dir }}/rst"
echo "::set-output name=build-html::${{ inputs.dest-dir }}/build/html"