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 f37bfe4601 Add staging publishing
f37bfe4601 is described below

commit f37bfe4601546242a4c46e837bea86a8286c5140
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Tue May 13 00:32:42 2025 +0200

    Add staging publishing
---
 .github/workflows/build.yml | 35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c4af016ff1..580e3df0a9 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -19,7 +19,7 @@ name: Build docs
 
 on:
   push:
-    branches: ['main']
+    branches: ['main', 'staging']
   pull_request:
   workflow_dispatch:
 
@@ -88,11 +88,18 @@ 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'
+        if: (github.event_name == 'push' || github.event_name == 
'workflow_dispatch') && github.ref == 'refs/heads/main'
         with:
           ref: publish
           fetch-depth: 1
           path: dist
+      - name: 🗂 Checkout publish-staging 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'
+        with:
+          ref: publish-staging
+          fetch-depth: 1
+          path: dist
       - name: 🔧 Build site
         run: |
           /mnt/airflow-site/site.sh build-site
@@ -149,7 +156,9 @@ 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'
+        if: >
+          github.event_name == 'push' || github.event_name == 
'workflow_dispatch' &&
+          github.repository == 'apache/airflow-site' && (gihub.ref == 
'refs/heads/main' || github.ref == 'refs/heads/staging')
         working-directory: dist
         run: |
           echo "Running git config"
@@ -159,7 +168,13 @@ jobs:
           git add .
           echo "Running git commit"
           git commit --no-edit -m "Docs updated via ${{ github.ref }}:${{ 
github.sha }}" > ../git_commit.log
-          git push origin publish
+          if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then
+            echo "Running git push to publish branch"
+            git push origin publish
+          else
+            echo "Running git push to publish-stging branch"
+            git push origin publish-staging
+          fi
       - name: 🚀 Upload git commit log as artifacts
         uses: actions/upload-artifact@v4
         with:
@@ -200,18 +215,24 @@ jobs:
           GITHUB_COMMIT: ${{ github.sha }}
           GITHUB_REF: ${{ github.ref }}
         if: >
-          github.ref == 'refs/heads/main' && github.repository == 
'apache/airflow-site' &&
+          (github.ref == 'refs/heads/main' || github.ref == 
'refs/head/stging') &&
+          github.repository == 'apache/airflow-site' &&
           (github.event_name == 'push' || github.event_name == 
'workflow_dispatch')
         run: |
           set -x
+          if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
+            SUFFIX=""
+          else
+            SUFFIX="-staging"
+          fi
           gh auth status
           VERSION="$(cd sphinx_airflow_theme; uv run python -c 'import 
sphinx_airflow_theme; print(sphinx_airflow_theme.__version__)')"
           TITLE=$(date "+%Y-%m-%d %H:%M:%S")
           NOTES="Commit: ${GITHUB_COMMIT}
           Source: ${GITHUB_REF}"
 
-          gh release delete "${VERSION}" -y || true
-          gh release create "${VERSION}" \
+          gh release delete "${VERSION}${SUFFIX}" -y || true
+          gh release create "${VERSION}${SUFFIX}" \
             --title "${TITLE}" \
             --notes "${NOTES}" \
             ./dist/*

Reply via email to