-
Notifications
You must be signed in to change notification settings - Fork 551
117 lines (103 loc) · 3.28 KB
/
build-package-docs.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
name: Ansible package docs build
on:
workflow_dispatch:
inputs:
repository-owner:
description: GitHub account or org that owns the repository
required: true
default: ansible
repository-name:
description: Name of the GitHub repository
required: true
default: ansible-documentation
repository-branch:
description: Branch, tag, or commit SHA
required: true
default: devel
language:
type: choice
description: Language
required: true
default: english
options:
- english
- japanese
ansible-package-version:
type: choice
description: Version of the Ansible community package to build
required: true
default: devel
options:
- devel
- '10'
- '9'
- '8'
- '7'
latest-symlink:
type: boolean
description: Add latest symlink
required: true
env:
PACKAGE_VERSION: ${{ github.event.inputs.ansible-package-version }}
LANGUAGE: ${{ github.event.inputs.language }}
jobs:
build-package-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout Ansible documentation
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.repository-owner }}/${{ github.event.inputs.repository-name }}
ref: ${{ github.event.inputs.repository-branch }}
path: build-directory
- name: Setup nox
uses: wntrblm/[email protected]
- name: Output Python info
run: python --version --version && which python
- name: Graft ansible-core
run: nox -s clone-core
working-directory: build-directory
- name: Install project requirements
run: |
python -m pip install \
-r tests/requirements.in \
-c tests/requirements.txt
working-directory: build-directory
- name: Set the COLLECTION_LIST variable
if: env.PACKAGE_VERSION != 'devel'
run: >-
echo COLLECTION_LIST='"${PACKAGE_VERSION}"'
>> "${GITHUB_ENV}"
- name: Set the VERSION variable
run: |
if [ ${LANGUAGE} == "english" ]; then
echo VERSION="${PACKAGE_VERSION}" >> "${GITHUB_ENV}"
elif [ ${LANGUAGE} == "japanese" ]; then
echo VERSION="${PACKAGE_VERSION}_ja" >> "${GITHUB_ENV}"
fi
- name: Build the Ansible community package docs
run: make webdocs ANSIBLE_VERSION="${COLLECTION_LIST}"
working-directory: build-directory/docs/docsite
- name: Create latest symlink
if: github.event.inputs.latest-symlink
run: ln -s "${VERSION}" _build/html/latest
working-directory: build-directory/docs/docsite
- name: Create a tarball with the build contents
run: >-
tar -czvf
ansible-package-docs-html-"${PACKAGE_VERSION}"-$(date '+%Y-%m-%d')-${{
github.run_id
}}-${{
github.run_number
}}-${{
github.run_attempt
}}.tar.gz
--directory=_build/html/ .
working-directory: build-directory/docs/docsite
- name: Create a downloadable archive that contains the tarball
uses: actions/upload-artifact@v4
with:
name: package-docs-build
path: build-directory/docs/docsite/build.tar.gz
retention-days: 7