Ansible package docs build #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 |