Skip to content

Commit 9f9f99e

Browse files
committed
Upload RST files too
1 parent 003b3ef commit 9f9f99e

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

.github/workflows/_shared-docs-build-pr.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ on:
4747
required: false
4848
type: string
4949
default: ${{ github.event.repository.name }}_docs_${{ github.event.pull_request.head.sha }}
50+
rst-artifact-name:
51+
description: The name of the RST artifact to upload.
52+
required: false
53+
type: string
54+
default: ${{ github.event.repository.name }}_rst_${{ github.event.pull_request.head.sha }}
5055
diff-size-limit:
5156
description: The max size of the diff, past which it will be truncated.
5257
required: false
@@ -223,6 +228,7 @@ jobs:
223228
build-html: ${{ steps.init-base.outputs.build-html }}
224229
copy-build: ${{ github.workspace }}/docsbuild/base
225230
artifact-upload: 'false'
231+
rst-artifact-upload: 'false'
226232

227233
- name: Checkout HEAD
228234
uses: actions/checkout@v3
@@ -253,8 +259,11 @@ jobs:
253259
with:
254260
build-script: ${{ steps.init-head.outputs.build-script }}
255261
build-html: ${{ steps.init-head.outputs.build-html }}
262+
build-rst: ${{ steps.init-head.outputs.build-rst }}
256263
copy-build: ${{ github.workspace }}/docsbuild/head
264+
copy-rst: ${{ github.workspace }}/rst
257265
artifact-name: ${{ inputs.artifact-name }}
266+
rst-artifact-name: ${{ inputs.rst-artifact-name }}
258267

259268
- name: Get a diff of the changes
260269
if: steps.build-base.outputs.hash != steps.build-head.outputs.hash

actions/ansible-docs-build-html/action.yml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,38 @@ inputs:
1010
description: The path where the build script will output the HTML.
1111
required: false
1212
default: ${{ runner.temp }}/docsbuild/build/html
13+
build-rst:
14+
description: The path where the build script will output the RST.
15+
required: false
16+
default: ${{ runner.temp }}/docsbuild/rst
1317
copy-build:
1418
description: |
1519
If set, copy the built HTML files to this path after building, and set the build-html output to this path instead.
1620
This is useful if you need to do multiple builds from the same environment, or otherwise need the files to be elsewhere.
1721
Note: files in the destination that do not exist in the source will be deleted!
1822
required: false
23+
copy-rst:
24+
description: |
25+
If set, copy the preprocessed RST files to this path after building, and set the build-rst output to this path instead.
26+
This is useful if you need to do multiple builds from the same environment, or otherwise need the files to be elsewhere.
27+
Note: files in the destination that do not exist in the source will be deleted!
28+
required: false
1929
artifact-upload:
2030
description: If true then upload the rendered docs as a build artifact.
2131
required: false
2232
default: 'true'
33+
rst-artifact-upload:
34+
description: If true then upload the rendered docs as a build artifact.
35+
required: false
36+
default: 'true'
2337
artifact-name:
2438
description: The name of the build artifact.
2539
required: false
2640
default: ${{ github.event.repository.name }}_docs
41+
rst-artifact-name:
42+
description: The name of the RST artifact.
43+
required: false
44+
default: ${{ github.event.repository.name }}_rst
2745
artifact-retention-days:
2846
description: Number of days to keep the artifact.
2947
required: false
@@ -53,7 +71,9 @@ runs:
5371
echo "::endgroup::"
5472
5573
HTML="${{ inputs.build-html }}"
74+
RST="${{ inputs.build-rst }}"
5675
COPY_BUILD="${{ inputs.copy-build }}"
76+
COPY_RST="${{ inputs.copy-rst }}"
5777
5878
if [[ "$COPY_BUILD" != "" ]] ; then
5979
echo "::group::Copy the build files"
@@ -65,14 +85,32 @@ runs:
6585
echo "::set-output name=build-html::$HTML"
6686
fi
6787
68-
- name: Upload artifact
88+
if [[ "$COPY_RST" != "" ]] ; then
89+
echo "::group::Copy the pre-processed files"
90+
mkdir -p "$COPY_RST"
91+
rsync -avc --delete-after "$RST/" "$COPY_RST/"
92+
echo "::set-output name=build-rst::$COPY_RST"
93+
echo "::endgroup::"
94+
else
95+
echo "::set-output name=build-rst::$RST"
96+
fi
97+
98+
- name: Upload HTML artifact
6999
if: fromJSON(inputs.artifact-upload)
70100
uses: actions/upload-artifact@v3
71101
with:
72102
path: ${{ steps.build.outputs.build-html }}
73103
name: ${{ inputs.artifact-name }}
74104
retention-days: ${{ fromJSON(inputs.artifact-retention-days) }}
75105

106+
- name: Upload RST artifact
107+
if: fromJSON(inputs.rst-artifact-upload)
108+
uses: actions/upload-artifact@v3
109+
with:
110+
path: ${{ steps.build.outputs.build-rst }}
111+
name: ${{ inputs.rst-artifact-name }}
112+
retention-days: ${{ fromJSON(inputs.artifact-retention-days) }}
113+
76114
- name: Output step
77115
id: outs
78116
shell: bash

actions/ansible-docs-build-init/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ outputs:
4343
build-html:
4444
description: The path of the build's html output directory.
4545
value: ${{ steps.init.outputs.build-html }}
46+
build-rst:
47+
description: The path of the build's RST output directory.
48+
value: ${{ steps.init.outputs.build-rst }}
4649

4750
runs:
4851
using: composite
@@ -77,4 +80,5 @@ runs:
7780
echo "::endgroup::"
7881
7982
echo "::set-output name=build-script::${{ inputs.dest-dir }}/build.sh"
83+
echo "::set-output name=build-rst::${{ inputs.dest-dir }}/rst"
8084
echo "::set-output name=build-html::${{ inputs.dest-dir }}/build/html"

0 commit comments

Comments
 (0)