Skip to content

Commit c12aea3

Browse files
authored
Allow to build apache-airflow documentation from branch rather than tag (#53583)
We sometimes want to build airflow docs from tip of the branch - and in this case we should be able to override the version we are building rather than deriving it from the TAG.
1 parent a2581cc commit c12aea3

File tree

5 files changed

+147
-21
lines changed

5 files changed

+147
-21
lines changed

.github/workflows/publish-docs-to-s3.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,14 @@ on: # yamllint disable-line rule:truthy
5252
required: false
5353
default: false
5454
type: boolean
55-
55+
airflow-base-version:
56+
required: false
57+
description: "Override the Airflow Base Version to use for the docs build"
58+
type: string
59+
airflow-version:
60+
required: false
61+
description: "Override the Airflow Version to use for the docs build"
62+
type: string
5663
permissions:
5764
contents: read
5865
jobs:
@@ -69,6 +76,8 @@ jobs:
6976
DESTINATION: ${{ inputs.destination }}
7077
SKIP_WRITE_TO_STABLE_FOLDER: ${{ inputs.skip-write-to-stable-folder }}
7178
BUILD_SBOMS: ${{ inputs.build-sboms }}
79+
AIRFLOW_BASE_VERSION: ${{ inputs.airflow-base-version || '' }}
80+
AIRFLOW_VERSION: ${{ inputs.airflow-version || '' }}
7281
outputs:
7382
include-docs: ${{ inputs.include-docs == 'all' && '' || inputs.include-docs }}
7483
destination-location: ${{ steps.parameters.outputs.destination-location }}
@@ -102,6 +111,8 @@ jobs:
102111
echo "Destination: '${DESTINATION}'"
103112
echo "Skip write to stable folder: '${SKIP_WRITE_TO_STABLE_FOLDER}'"
104113
echo "Build SBOMs: '${BUILD_SBOMS}'"
114+
echo "Airflow Base Version: '${AIRFLOW_BASE_VERSION}'"
115+
echo "Airflow Version: '${AIRFLOW_VERSION}'"
105116
if [[ "${DESTINATION}" == "auto" ]]; then
106117
if [[ "${REF}" =~ ^.*[0-9]*\.[0-9]*\.[0-9]*$ ]]; then
107118
echo "${REF} looks like final release, using live destination"
@@ -118,8 +129,20 @@ jobs:
118129
echo "destination-location=s3://staging-docs-airflow-apache-org/docs/" >> ${GITHUB_OUTPUT}
119130
fi
120131
if [[ " ${INCLUDE_DOCS} " =~ " apache-airflow " ]]; then
121-
AIRFLOW_BASE_VERSION=$(echo "${REF}" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
122-
AIRFLOW_VERSION="${REF}"
132+
if [[ ${AIRFLOW_BASE_VERSION=} == "" && ${AIRFLOW_VERSION=} == "" ]]; then
133+
echo "No Airflow Versions provided, using ${REF} to determine it."
134+
AIRFLOW_VERSION="${REF}"
135+
set +e
136+
AIRFLOW_BASE_VERSION=$(echo "${REF}" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
137+
set -e
138+
if [[ ${AIRFLOW_BASE_VERSION=} == "" ]]; then
139+
echo
140+
echo "No Airflow Base Version found in ${REF}"
141+
echo "You need to force airflow version and airflow base version in the workflow."
142+
echo
143+
exit 1
144+
fi
145+
fi
123146
echo "airflow-base-version=${AIRFLOW_BASE_VERSION}" >> ${GITHUB_OUTPUT}
124147
echo "airflow-version=${AIRFLOW_VERSION}" >> ${GITHUB_OUTPUT}
125148
else

0 commit comments

Comments
 (0)