This is an automated email from the ASF dual-hosted git repository.

gopidesu pushed a commit to branch update-s3-cp-index
in repository https://gitbox.apache.org/repos/asf/airflow-site.git


The following commit(s) were added to refs/heads/update-s3-cp-index by this 
push:
     new 5af1540f20 Update conditions
5af1540f20 is described below

commit 5af1540f20882bde73c74c955680e209e84dfd3b
Author: Pavan Kumar <[email protected]>
AuthorDate: Tue May 13 02:00:35 2025 +0100

    Update conditions
---
 .github/workflows/build.yml | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index adde1290a5..e27fb33d6c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -26,6 +26,10 @@ 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:
       # Based on https://github.com/actions/runner-images/issues/2840
       - name: 🪓 Remove some stuff we don't need
@@ -88,14 +92,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 +108,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 +116,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 +124,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 +173,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 +188,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 +244,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

Reply via email to