Skip to content

Extension for Ansible redirects #2418

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

Open
wants to merge 15 commits into
base: devel
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
12 changes: 6 additions & 6 deletions .github/workflows/build-package-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,36 @@ name: Build and deploy docs
repository-owner:
description: GitHub account or org that owns the repository
type: string
required: true
default: ansible
repository-name:
description: Name of the GitHub repository
type: string
required: true
default: ansible-documentation
repository-branch:
description: Branch, tag, or commit SHA
type: string
required: true
default: devel
ansible-package-version:
description: Ansible community package version
type: choice
required: true
default: devel
options:
- devel
- '12'
- '11'
- '10'
- '9'
generate-redirects:
description: Generate page redirects
type: boolean
default: true
deploy:
description: Deploy the build
type: boolean
required: true
default: false
deployment-environment:
description: Deployment environment
type: choice
required: true
default: test
options:
- production
Expand All @@ -54,6 +53,7 @@ jobs:
repository-name: ${{ github.event.inputs.repository-name || 'ansible-documentation' }}
repository-branch: ${{ github.event.inputs.repository-branch || 'devel' }}
ansible-package-version: ${{ github.event.inputs.ansible-package-version || 'devel' }}
generate-redirects: ${{ github.event.inputs.generate-redirects || 'false' }}
secrets:
DOCS_BOT_TOKEN: ${{ secrets.DOCS_BOT_TOKEN }}

Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/reusable-build-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ name: Build docs
description: Ansible community package version
required: false
default: devel
generate-redirects:
description: Generate page redirects
type: boolean
required: true
secrets:
DOCS_BOT_TOKEN:
required: true
Expand All @@ -34,6 +38,8 @@ env:
jobs:
build-package-docs:
runs-on: ubuntu-latest
env:
REDIRECTS: ${{ github.event.inputs.generate-redirects }}
steps:
- name: Checkout Ansible documentation
uses: actions/checkout@v4
Expand Down Expand Up @@ -68,8 +74,19 @@ jobs:
run: echo VERSION="${PACKAGE_VERSION}" >> "${GITHUB_ENV}"

- name: Build the Ansible community package docs
if: env.REDIRECTS == 'true'
run: >-
make webdocs EXTRA_TAGS="-t redirects" ANSIBLE_VERSION="${{
env.PACKAGE_VERSION != 'devel' && env.PACKAGE_VERSION || ''
}}"
working-directory: build-directory/docs/docsite

- name: Build the Ansible community package docs
if: env.REDIRECTS == 'false'
Comment on lines +77 to +85
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if: env.REDIRECTS == 'true'
run: >-
make webdocs EXTRA_TAGS="-t redirects" ANSIBLE_VERSION="${{
env.PACKAGE_VERSION != 'devel' && env.PACKAGE_VERSION || ''
}}"
working-directory: build-directory/docs/docsite
- name: Build the Ansible community package docs
if: env.REDIRECTS == 'false'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@webknjaz I believe this should be conditional based on the inputs. For some builds, such as deploying to gh-pages, you probably don't want to generate redirects.

Also if we remove the condition here, shouldn't we remove the generate-redirects input?

run: >-
make webdocs ANSIBLE_VERSION="${{
make webdocs ${{
fromJSON(env.REDIRECTS) && '-t redirects' || ''
}} ANSIBLE_VERSION="${{
env.PACKAGE_VERSION != 'devel' && env.PACKAGE_VERSION || ''
}}"
working-directory: build-directory/docs/docsite
Expand Down
3 changes: 2 additions & 1 deletion docs/docsite/Makefile.sphinx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
#

# You can set these variables from the command line.
EXTRA_TAGS ?=
DOCS_VARIANTS ?=
SPHINXCONFDIR = rst
LANGOPTS ?=
SPHINXOPTS ?= -j $(CPUS) -n -w rst_warnings -c "$(SPHINXCONFDIR)" $(DOCS_VARIANTS) $(LANGOPTS)
SPHINXOPTS ?= -j $(CPUS) -n -w rst_warnings -c "$(SPHINXCONFDIR)" $(DOCS_VARIANTS) $(EXTRA_TAGS) $(LANGOPTS)
SPHINXBUILD = sphinx-build
SPHINXPROJ = sdfsdf
SOURCEDIR = rst
Expand Down
Loading