This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow-site.git
The following commit(s) were added to refs/heads/main by this push:
new f2511579a7 Update conditions to evaluate branch/dispatch events (#1200)
f2511579a7 is described below
commit f2511579a77b7a0494e91323ce9389816b0b7943
Author: GPK <[email protected]>
AuthorDate: Tue May 13 10:49:59 2025 +0100
Update conditions to evaluate branch/dispatch events (#1200)
* Update conditions
* Update conditions
---
.github/workflows/build.yml | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index adde1290a5..24dbe65339 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -26,7 +26,16 @@ on:
jobs:
build:
runs-on: ["ubuntu-22.04"]
+ env:
+ S3_DOCS_BUCKET: ${{github.ref == 'refs/heads/staging' &&
'staging-docs-airflow-apache-org' || 'live-docs-airflow-apache-org'}}
+ PROD_PUBLISH_REQUIRED: ${{ (github.event_name == 'push' ||
github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main' ||
'false' }}
+ STAGING_PUBLISH_REQUIRED: ${{ (github.event_name == 'push' ||
github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/staging'
|| 'false' }}
steps:
+ - name: âšī¸ Info
+ run: |
+ echo "Using s3 bucket to copy index: ${S3_DOCS_BUCKET}"
+ echo "PROD_PUBLISH_REQUIRED: ${PROD_PUBLISH_REQUIRED}"
+ echo "STAGING_PUBLISH_REQUIRED: ${STAGING_PUBLISH_REQUIRED}"
# Based on https://github.com/actions/runner-images/issues/2840
- name: đĒ Remove some stuff we don't need
run: |
@@ -88,14 +97,14 @@ jobs:
pre-commit run --all-files --color always
- name: đ Checkout publish branch with minimum depth
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #
3.5.3
- if: (github.event_name == 'push' || github.event_name ==
'workflow_dispatch') && github.ref == 'refs/heads/main'
+ if: env.PROD_PUBLISH_REQUIRED != 'false'
with:
ref: publish
fetch-depth: 1
path: dist
- name: đ Checkout staging-publish branch with minimum depth
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #
3.5.3
- if: (github.event_name == 'push' || github.event_name ==
'workflow_dispatch') && github.ref == 'refs/heads/staging'
+ if: env.STAGING_PUBLISH_REQUIRED != 'false'
with:
ref: staging-publish
fetch-depth: 1
@@ -104,7 +113,7 @@ jobs:
run: |
/mnt/airflow-site/site.sh build-site
- name: Install AWS CLI v2
- if: github.event_name == 'push' || github.event_name ==
'workflow_dispatch'
+ if: env.PROD_PUBLISH_REQUIRED != 'false' ||
env.STAGING_PUBLISH_REQUIRED != 'false'
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o
/tmp/awscliv2.zip
unzip -q /tmp/awscliv2.zip -d /tmp
@@ -112,7 +121,7 @@ jobs:
sudo /tmp/aws/install --update
rm -rf /tmp/aws/
- name: Configure AWS credentials
- if: github.event_name == 'push' || github.event_name ==
'workflow_dispatch'
+ if: env.PROD_PUBLISH_REQUIRED != 'false' ||
env.STAGING_PUBLISH_REQUIRED != 'false'
uses:
aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a
# v4.0.1
with:
aws-access-key-id: ${{ secrets.DOCS_AWS_ACCESS_KEY_ID }}
@@ -120,10 +129,10 @@ jobs:
aws-region: us-east-2
- name: Copy docs index page to S3 docs
- if: github.event_name == 'push' || github.event_name ==
'workflow_dispatch'
+ if: env.PROD_PUBLISH_REQUIRED != 'false' ||
env.STAGING_PUBLISH_REQUIRED != 'false'
run: |
- aws s3 cp ./dist/docs/index.html
s3://live-docs-airflow-apache-org/docs/index.html
- aws s3 cp ./dist/docs/index.xml
s3://live-docs-airflow-apache-org/docs/index.xml
+ aws s3 cp ./dist/docs/index.html
s3://${S3_DOCS_BUCKET}/docs/index.html
+ aws s3 cp ./dist/docs/index.xml s3://${S3_DOCS_BUCKET}/docs/index.xml
- name: đ
Optimize artifacts
if: ${{ github.event_name == 'pull_request' }}
@@ -169,7 +178,7 @@ jobs:
working-directory: ./dist
if: github.ref == 'refs/heads/staging'
- name: đˇ Copy .asf.yaml to /dist/
- if: github.event_name == 'push' || github.event_name ==
'workflow_dispatch'
+ if: env.PROD_PUBLISH_REQUIRED != 'false' ||
env.STAGING_PUBLISH_REQUIRED != 'false'
run: |
# The asf.yaml file must be in the branch from which the files are
published.
# Otherwise, ASF publising tools cannot detect it.
@@ -184,9 +193,7 @@ jobs:
run: |
uv run ./.github/scripts/refresh_pmc_committer_images.py
- name: đ Add commit to publish branch and deploy it
- if: >
- github.event_name == 'push' || github.event_name ==
'workflow_dispatch' &&
- github.repository == 'apache/airflow-site' && (github.ref ==
'refs/heads/main' || github.ref == 'refs/heads/staging')
+ if: env.PROD_PUBLISH_REQUIRED != 'false' ||
env.STAGING_PUBLISH_REQUIRED != 'false'
working-directory: dist
run: |
echo "Running git config"
@@ -242,10 +249,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_COMMIT: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
- if: >
- (github.ref == 'refs/heads/main' || github.ref ==
'refs/head/staging') &&
- github.repository == 'apache/airflow-site' &&
- (github.event_name == 'push' || github.event_name ==
'workflow_dispatch')
+ if: env.PROD_PUBLISH_REQUIRED != 'false' ||
env.STAGING_PUBLISH_REQUIRED != 'false'
run: |
set -x
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then