Skip to content

Commit 8ede9bc

Browse files
committed
build package docs via gh action
1 parent bed2f27 commit 8ede9bc

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Ansible package docs build
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
github_fork:
6+
description: 'GitHub Fork'
7+
required: true
8+
default: 'ansible'
9+
github_branch:
10+
description: 'GitHub Branch'
11+
required: true
12+
default: 'devel'
13+
language:
14+
type: choice
15+
description: 'Language'
16+
required: true
17+
default: 'english'
18+
options:
19+
- 'english'
20+
- 'japanese'
21+
package_version:
22+
type: choice
23+
description: 'Ansible Version'
24+
required: true
25+
default: 'devel'
26+
options:
27+
- 'devel'
28+
- '9'
29+
- '8'
30+
- '7'
31+
- '6'
32+
- '5'
33+
- '4'
34+
- '3'
35+
- '2.10'
36+
latest_symlink:
37+
type: boolean
38+
description: 'Add latest symlink'
39+
required: true
40+
41+
jobs:
42+
build-package-docs:
43+
runs-on: ubuntu-latest
44+
env:
45+
PACKAGE_VERSION: "${{ github.event.inputs.package_version }}"
46+
LANGUAGE: ${{ github.event.inputs.language}}
47+
steps:
48+
- name: Checkout Ansible documentation
49+
uses: actions/checkout@v4
50+
with:
51+
repository: ${{ github.event.inputs.github_fork }}/ansible-documentation
52+
ref: ${{ github.event.inputs.github_branch }}
53+
path: build-directory
54+
55+
- name: Setup nox
56+
uses: wntrblm/[email protected]
57+
58+
- name: Output Python info
59+
run: python --version --version && which python
60+
61+
- name: Graft ansible-core
62+
run: |
63+
pushd build-directory
64+
nox -s clone-core
65+
popd
66+
67+
- name: Install project requirements
68+
run: |
69+
pushd build-directory
70+
python -m pip install -r tests/requirements.in -c tests/requirements.txt
71+
popd
72+
73+
- name: Set the COLLECTION_LIST variable
74+
run: |
75+
if [ ${PACKAGE_VERSION} == "devel" ]; then
76+
echo COLLECTION_LIST="" >> $GITHUB_ENV
77+
else
78+
echo COLLECTION_LIST="${PACKAGE_VERSION}" >> $GITHUB_ENV
79+
fi
80+
81+
- name: Set the VERSION variable
82+
run: |
83+
if [ ${LANGUAGE} == "english" ]; then
84+
echo VERSION="${PACKAGE_VERSION}" >> $GITHUB_ENV
85+
elif [ ${LANGUAGE} == "japanese" ]; then
86+
echo VERSION="${PACKAGE_VERSION}_ja" >> $GITHUB_ENV
87+
fi
88+
89+
- name: Build the docs
90+
run: |
91+
pushd build-directory/docs/docsite
92+
make webdocs ANSIBLE_VERSION="${COLLECTION_LIST}"
93+
popd
94+
95+
- name: Create latest symlink
96+
if: ${{ github.event.inputs.latest_symlink == 'true' }}
97+
run: |
98+
pushd build-directory/docs/docsite
99+
ln -s ${VERSION} _build/latest
100+
popd

0 commit comments

Comments
 (0)