(airflow-site) 01/01: Update watermark processing to use python script

2025-05-14 Thread potiuk
This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/airflow-site.git

commit 54fd0b6cc707ff83006d03161de7ff6d7c061f6b
Author: Jarek Potiuk 
AuthorDate: Wed May 14 22:07:12 2025 +0100

Update watermark processing to use python script
---
 .github/scripts/add_watermark.py   |  84 +
 .../static => .github/scripts}/images/staging.png  | Bin
 .github/workflows/build.yml|  43 +++
 3 files changed, 94 insertions(+), 33 deletions(-)

diff --git a/.github/scripts/add_watermark.py b/.github/scripts/add_watermark.py
new file mode 100755
index 00..0ae4ddff1b
--- /dev/null
+++ b/.github/scripts/add_watermark.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+#   "rich>=14.0.0",
+# ]
+# ///
+
+import shutil
+import argparse
+from pathlib import Path
+
+from rich.console import Console
+
+console = Console(width=200, color_system="standard")
+
+CSS_TO_ADD = """
+  body {
+  position: relative; /* Ensures the pseudo-element is positioned relative 
to the body */
+  z-index: 0; /* Keeps the content above the pseudo-element */
+  }
+
+  body::before {
+  content: "";
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background: url(URL_PREFIX/staging.png) repeat center center fixed; /* 
Sets the background image */
+  opacity: 0.2; /* Makes the watermark semi-transparent */
+  pointer-events: none; /* Ensures the watermark doesn't interfere with 
user interactions */
+  z-index: -1; /* Places the pseudo-element behind all other elements */
+  }
+"""
+
+IMAGE_FILE=Path(__file__).parent / "images" / "staging.png"
+
+if __name__ == "__main__":
+parser = argparse.ArgumentParser(description="Add watermark")
+parser.add_argument("--folder", required=True, help="Folder to look for 
css files for")
+parser.add_argument("--pattern", required=True, help="Glob pattern to look 
for")
+parser.add_argument("--url-prefix", required=True, help="URL prefix to use 
for the image")
+parser.add_argument("--image-directory", required=True,
+help="Image directory where image should be 
written-relative to folder path.")
+console.print("[bright_blue]Adding watermark to the site's CSS")
+args = parser.parse_args()
+
+folder_path = Path(args.folder)
+pattern = args.pattern
+url_prefix = args.url_prefix
+image_directory_path = Path(args.image_directory)
+
+content_to_add = CSS_TO_ADD.replace("URL_PREFIX", url_prefix)
+console.print(f"[bright_blue]Looking for css files following '{pattern}' 
pattern[/] in {folder_path}")
+files = folder_path.rglob(pattern)
+for file in files:
+content = file.read_text()
+if not "watermark semi-transparent" in content:
+console.print(f"[yellow]Adding watermark to:[/] {file}")
+content = content + content_to_add
+file.write_text(content)
+else:
+console.print("[red]Not found files to update css in.")
+target_image_location = folder_path / image_directory_path
+target_image_location.mkdir(parents=True, exist_ok=True)
+shutil.copy(IMAGE_FILE, target_image_location / "staging.png")
diff --git a/landing-pages/site/static/images/staging.png 
b/.github/scripts/images/staging.png
similarity index 100%
rename from landing-pages/site/static/images/staging.png
rename to .github/scripts/images/staging.png
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ef11652df3..918a628732 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -141,34 +141,16 @@ jobs:
   name: airflow-website
   path: './dist'
   if-no-files-found: error
-  retention-days: 14
-  - name: Apply staging modifications
+  retention-days: 7
+  - name: "Apply staging modifications: .htaccess and watermarks"
 run: |
-  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' .ht

(airflow-site) 01/01: Update watermark processing to use python script

2025-05-14 Thread potiuk
This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/airflow-site.git

commit 5aeb8f138cf12fae86537a3278734ab7e3c4b559
Author: Jarek Potiuk 
AuthorDate: Wed May 14 22:07:12 2025 +0100

Update watermark processing to use python script
---
 .github/scripts/add_watermark.py   |  84 +
 .../static => .github/scripts}/images/staging.png  | Bin
 .github/workflows/build.yml|  43 +++
 3 files changed, 94 insertions(+), 33 deletions(-)

diff --git a/.github/scripts/add_watermark.py b/.github/scripts/add_watermark.py
new file mode 100755
index 00..0ae4ddff1b
--- /dev/null
+++ b/.github/scripts/add_watermark.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+#   "rich>=14.0.0",
+# ]
+# ///
+
+import shutil
+import argparse
+from pathlib import Path
+
+from rich.console import Console
+
+console = Console(width=200, color_system="standard")
+
+CSS_TO_ADD = """
+  body {
+  position: relative; /* Ensures the pseudo-element is positioned relative 
to the body */
+  z-index: 0; /* Keeps the content above the pseudo-element */
+  }
+
+  body::before {
+  content: "";
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background: url(URL_PREFIX/staging.png) repeat center center fixed; /* 
Sets the background image */
+  opacity: 0.2; /* Makes the watermark semi-transparent */
+  pointer-events: none; /* Ensures the watermark doesn't interfere with 
user interactions */
+  z-index: -1; /* Places the pseudo-element behind all other elements */
+  }
+"""
+
+IMAGE_FILE=Path(__file__).parent / "images" / "staging.png"
+
+if __name__ == "__main__":
+parser = argparse.ArgumentParser(description="Add watermark")
+parser.add_argument("--folder", required=True, help="Folder to look for 
css files for")
+parser.add_argument("--pattern", required=True, help="Glob pattern to look 
for")
+parser.add_argument("--url-prefix", required=True, help="URL prefix to use 
for the image")
+parser.add_argument("--image-directory", required=True,
+help="Image directory where image should be 
written-relative to folder path.")
+console.print("[bright_blue]Adding watermark to the site's CSS")
+args = parser.parse_args()
+
+folder_path = Path(args.folder)
+pattern = args.pattern
+url_prefix = args.url_prefix
+image_directory_path = Path(args.image_directory)
+
+content_to_add = CSS_TO_ADD.replace("URL_PREFIX", url_prefix)
+console.print(f"[bright_blue]Looking for css files following '{pattern}' 
pattern[/] in {folder_path}")
+files = folder_path.rglob(pattern)
+for file in files:
+content = file.read_text()
+if not "watermark semi-transparent" in content:
+console.print(f"[yellow]Adding watermark to:[/] {file}")
+content = content + content_to_add
+file.write_text(content)
+else:
+console.print("[red]Not found files to update css in.")
+target_image_location = folder_path / image_directory_path
+target_image_location.mkdir(parents=True, exist_ok=True)
+shutil.copy(IMAGE_FILE, target_image_location / "staging.png")
diff --git a/landing-pages/site/static/images/staging.png 
b/.github/scripts/images/staging.png
similarity index 100%
rename from landing-pages/site/static/images/staging.png
rename to .github/scripts/images/staging.png
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ef11652df3..0f22f82243 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -141,34 +141,16 @@ jobs:
   name: airflow-website
   path: './dist'
   if-no-files-found: error
-  retention-days: 14
-  - name: Apply staging modifications
+  retention-days: 7
+  - name: "Apply staging modifications: .htaccess and watermarks"
 run: |
-  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' .ht

(airflow-site) 01/01: Update watermark processing to use python script

2025-05-14 Thread potiuk
This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/airflow-site.git

commit 944c4c3736a5ea999114e37b0b196d94bbfd214c
Author: Jarek Potiuk 
AuthorDate: Wed May 14 22:07:12 2025 +0100

Update watermark processing to use python script
---
 .github/scripts/add_watermark.py   |  84 +
 .../static => .github/scripts}/images/staging.png  | Bin
 .github/workflows/build.yml|  43 +++
 3 files changed, 94 insertions(+), 33 deletions(-)

diff --git a/.github/scripts/add_watermark.py b/.github/scripts/add_watermark.py
new file mode 100755
index 00..e3d4f59d67
--- /dev/null
+++ b/.github/scripts/add_watermark.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+#   "rich>=14.0.0",
+# ]
+# ///
+
+import shutil
+import argparse
+from pathlib import Path
+
+from rich.console import Console
+
+console = Console(width=200, color_system="standard")
+
+CSS_TO_ADD = """
+  body {
+  position: relative; /* Ensures the pseudo-element is positioned relative 
to the body */
+  z-index: 0; /* Keeps the content above the pseudo-element */
+  }
+
+  body::before {
+  content: "";
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background: url(URL_PREFIX/staging.png) repeat center center fixed; /* 
Sets the background image */
+  opacity: 0.2; /* Makes the watermark semi-transparent */
+  pointer-events: none; /* Ensures the watermark doesn't interfere with 
user interactions */
+  z-index: -1; /* Places the pseudo-element behind all other elements */
+  }
+"""
+
+IMAGE_FILE=Path(__file__).parent / "images" / "staging.png"
+
+if __name__ == "__main__":
+parser = argparse.ArgumentParser(description="Add watermark")
+parser.add_argument("--folder", required=True, help="Folder to look for 
css files for")
+parser.add_argument("--pattern", required=True, help="Glob pattern to look 
for")
+parser.add_argument("--url-prefix", required=True, help="URL prefix to use 
for the image")
+parser.add_argument("--image-directory", required=True,
+help="Image directory where image should be 
written-relative to folder path.")
+console.print("[bright_blue]Adding watermark to the site's CSS")
+args = parser.parse_args()
+
+folder_path = Path(args.folder)
+pattern = args.pattern
+url_prefix = args.url_prefix
+image_directory_path = Path(args.image_directory)
+
+content_to_add = CSS_TO_ADD.replace("URL_PREFIX", url_prefix)
+
+files = folder_path.rglob(pattern)
+for file in files:
+content = file.read_text()
+if not "watermark semi-transparent" in content:
+console.print(f"[bright_blue]Adding watermark to:[/] {file}")
+content = content + content_to_add
+file.write_text(content)
+else:
+console.print("[red]Not found files to update css in.")
+target_image_location = folder_path / image_directory_path
+target_image_location.mkdir(parents=True, exist_ok=True)
+shutil.copy(IMAGE_FILE, target_image_location / "staging.png")
diff --git a/landing-pages/site/static/images/staging.png 
b/.github/scripts/images/staging.png
similarity index 100%
rename from landing-pages/site/static/images/staging.png
rename to .github/scripts/images/staging.png
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ef11652df3..0f22f82243 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -141,34 +141,16 @@ jobs:
   name: airflow-website
   path: './dist'
   if-no-files-found: error
-  retention-days: 14
-  - name: Apply staging modifications
+  retention-days: 7
+  - name: "Apply staging modifications: .htaccess and watermarks"
 run: |
-  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' .htaccess
-  echo "Updated .htaccess"
-  cat .htaccess
+  set -x
+  sed -

(airflow-site) 01/01: Update watermark processing to use python script

2025-05-14 Thread potiuk
This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/airflow-site.git

commit f5e82c97687645e26b2b80e34a32d4c76ac03861
Author: Jarek Potiuk 
AuthorDate: Wed May 14 22:07:12 2025 +0100

Update watermark processing to use python script
---
 .github/scripts/add_watermark.py   |  81 +
 .../static => .github/scripts}/images/staging.png  | Bin
 .github/workflows/build.yml|  43 +++
 3 files changed, 91 insertions(+), 33 deletions(-)

diff --git a/.github/scripts/add_watermark.py b/.github/scripts/add_watermark.py
new file mode 100755
index 00..2aad7aa764
--- /dev/null
+++ b/.github/scripts/add_watermark.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+#   "rich>=14.0.0",
+# ]
+# ///
+
+import shutil
+import argparse
+from pathlib import Path
+
+from rich.console import Console
+
+console = Console(width=200, color_system="standard")
+
+CSS_TO_ADD = """
+  body {
+  position: relative; /* Ensures the pseudo-element is positioned relative 
to the body */
+  z-index: 0; /* Keeps the content above the pseudo-element */
+  }
+
+  body::before {
+  content: "";
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background: url(URL_PREFIX/staging.png) repeat center center fixed; /* 
Sets the background image */
+  opacity: 0.2; /* Makes the watermark semi-transparent */
+  pointer-events: none; /* Ensures the watermark doesn't interfere with 
user interactions */
+  z-index: -1; /* Places the pseudo-element behind all other elements */
+  }
+"""
+
+IMAGE_FILE=Path(__file__).parent / "images" / "staging.png"
+
+if __name__ == "__main__":
+parser = argparse.ArgumentParser(description="Add watermark")
+parser.add_argument("--folder", required=True, help="Folder to look for 
css files for")
+parser.add_argument("--pattern", required=True, help="Glob pattern to look 
for")
+parser.add_argument("--url-prefix", required=True, help="URL prefix to use 
for the image")
+parser.add_argument("--image-directory", required=True,
+help="Image directory where image should be 
written-relative to folder path.")
+args = parser.parse_args()
+
+folder_path = Path(args.folder)
+pattern = args.pattern
+url_prefix = args.url_prefix
+image_directory_path = Path(args.image_directory)
+
+content_to_add = CSS_TO_ADD.replace("URL_PREFIX", url_prefix)
+
+files = folder_path.rglob(pattern)
+for file in files:
+content = file.read_text()
+if not "watermark semi-transparent" in content:
+console.print(f"[bright_blue]Adding watermark to:[/] {file}")
+content = content + content_to_add
+file.write_text(content)
+target_image_location = folder_path / image_directory_path
+target_image_location.mkdir(parents=True, exist_ok=True)
+shutil.copy(IMAGE_FILE, target_image_location / "staging.png")
diff --git a/landing-pages/site/static/images/staging.png 
b/.github/scripts/images/staging.png
similarity index 100%
rename from landing-pages/site/static/images/staging.png
rename to .github/scripts/images/staging.png
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ef11652df3..a6d5295950 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -141,34 +141,16 @@ jobs:
   name: airflow-website
   path: './dist'
   if-no-files-found: error
-  retention-days: 14
-  - name: Apply staging modifications
+  retention-days: 7
+  - name: "Apply staging modifications: .htaccess and watermarks"
 run: |
-  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' .htaccess
-  echo "Updated .htaccess"
-  cat .htaccess
+  set -x
+  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' ./dist/.htaccess
+  echo "Updated ./dist/.htaccess"
+  cat ./di

(airflow-site) 01/01: Update watermark processing to use python script

2025-05-14 Thread potiuk
This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/airflow-site.git

commit 47f17af483c63f0557952540d92f9dff904f9c4b
Author: Jarek Potiuk 
AuthorDate: Wed May 14 22:07:12 2025 +0100

Update watermark processing to use python script
---
 .github/scripts/add_watermark.py   |  81 +
 .../static => .github/scripts}/images/staging.png  | Bin
 .github/workflows/build.yml|  43 +++
 3 files changed, 91 insertions(+), 33 deletions(-)

diff --git a/.github/scripts/add_watermark.py b/.github/scripts/add_watermark.py
new file mode 100755
index 00..2aad7aa764
--- /dev/null
+++ b/.github/scripts/add_watermark.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+#   "rich>=14.0.0",
+# ]
+# ///
+
+import shutil
+import argparse
+from pathlib import Path
+
+from rich.console import Console
+
+console = Console(width=200, color_system="standard")
+
+CSS_TO_ADD = """
+  body {
+  position: relative; /* Ensures the pseudo-element is positioned relative 
to the body */
+  z-index: 0; /* Keeps the content above the pseudo-element */
+  }
+
+  body::before {
+  content: "";
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background: url(URL_PREFIX/staging.png) repeat center center fixed; /* 
Sets the background image */
+  opacity: 0.2; /* Makes the watermark semi-transparent */
+  pointer-events: none; /* Ensures the watermark doesn't interfere with 
user interactions */
+  z-index: -1; /* Places the pseudo-element behind all other elements */
+  }
+"""
+
+IMAGE_FILE=Path(__file__).parent / "images" / "staging.png"
+
+if __name__ == "__main__":
+parser = argparse.ArgumentParser(description="Add watermark")
+parser.add_argument("--folder", required=True, help="Folder to look for 
css files for")
+parser.add_argument("--pattern", required=True, help="Glob pattern to look 
for")
+parser.add_argument("--url-prefix", required=True, help="URL prefix to use 
for the image")
+parser.add_argument("--image-directory", required=True,
+help="Image directory where image should be 
written-relative to folder path.")
+args = parser.parse_args()
+
+folder_path = Path(args.folder)
+pattern = args.pattern
+url_prefix = args.url_prefix
+image_directory_path = Path(args.image_directory)
+
+content_to_add = CSS_TO_ADD.replace("URL_PREFIX", url_prefix)
+
+files = folder_path.rglob(pattern)
+for file in files:
+content = file.read_text()
+if not "watermark semi-transparent" in content:
+console.print(f"[bright_blue]Adding watermark to:[/] {file}")
+content = content + content_to_add
+file.write_text(content)
+target_image_location = folder_path / image_directory_path
+target_image_location.mkdir(parents=True, exist_ok=True)
+shutil.copy(IMAGE_FILE, target_image_location / "staging.png")
diff --git a/landing-pages/site/static/images/staging.png 
b/.github/scripts/images/staging.png
similarity index 100%
rename from landing-pages/site/static/images/staging.png
rename to .github/scripts/images/staging.png
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ef11652df3..cfb8821646 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -141,34 +141,16 @@ jobs:
   name: airflow-website
   path: './dist'
   if-no-files-found: error
-  retention-days: 14
-  - name: Apply staging modifications
+  retention-days: 7
+  - name: "Apply staging modifications: .htaccess and watermarks"
 run: |
-  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' .htaccess
-  echo "Updated .htaccess"
-  cat .htaccess
+  set -x
+  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' ./dist/.htaccess
+  echo "Updated ./dist/.htaccess"
+  cat ./di

(airflow-site) 01/01: Update watermark processing to use python script

2025-05-14 Thread potiuk
This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/airflow-site.git

commit 8a83ffa3247af266319aa06e5b756e3ad93ab066
Author: Jarek Potiuk 
AuthorDate: Wed May 14 22:07:12 2025 +0100

Update watermark processing to use python script
---
 .github/scripts/add_watermark.py   |  81 +
 .../static => .github/scripts}/images/staging.png  | Bin
 .github/workflows/build.yml|  35 +++--
 3 files changed, 90 insertions(+), 26 deletions(-)

diff --git a/.github/scripts/add_watermark.py b/.github/scripts/add_watermark.py
new file mode 100755
index 00..2aad7aa764
--- /dev/null
+++ b/.github/scripts/add_watermark.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+#   "rich>=14.0.0",
+# ]
+# ///
+
+import shutil
+import argparse
+from pathlib import Path
+
+from rich.console import Console
+
+console = Console(width=200, color_system="standard")
+
+CSS_TO_ADD = """
+  body {
+  position: relative; /* Ensures the pseudo-element is positioned relative 
to the body */
+  z-index: 0; /* Keeps the content above the pseudo-element */
+  }
+
+  body::before {
+  content: "";
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background: url(URL_PREFIX/staging.png) repeat center center fixed; /* 
Sets the background image */
+  opacity: 0.2; /* Makes the watermark semi-transparent */
+  pointer-events: none; /* Ensures the watermark doesn't interfere with 
user interactions */
+  z-index: -1; /* Places the pseudo-element behind all other elements */
+  }
+"""
+
+IMAGE_FILE=Path(__file__).parent / "images" / "staging.png"
+
+if __name__ == "__main__":
+parser = argparse.ArgumentParser(description="Add watermark")
+parser.add_argument("--folder", required=True, help="Folder to look for 
css files for")
+parser.add_argument("--pattern", required=True, help="Glob pattern to look 
for")
+parser.add_argument("--url-prefix", required=True, help="URL prefix to use 
for the image")
+parser.add_argument("--image-directory", required=True,
+help="Image directory where image should be 
written-relative to folder path.")
+args = parser.parse_args()
+
+folder_path = Path(args.folder)
+pattern = args.pattern
+url_prefix = args.url_prefix
+image_directory_path = Path(args.image_directory)
+
+content_to_add = CSS_TO_ADD.replace("URL_PREFIX", url_prefix)
+
+files = folder_path.rglob(pattern)
+for file in files:
+content = file.read_text()
+if not "watermark semi-transparent" in content:
+console.print(f"[bright_blue]Adding watermark to:[/] {file}")
+content = content + content_to_add
+file.write_text(content)
+target_image_location = folder_path / image_directory_path
+target_image_location.mkdir(parents=True, exist_ok=True)
+shutil.copy(IMAGE_FILE, target_image_location / "staging.png")
diff --git a/landing-pages/site/static/images/staging.png 
b/.github/scripts/images/staging.png
similarity index 100%
rename from landing-pages/site/static/images/staging.png
rename to .github/scripts/images/staging.png
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ef11652df3..4fa0bed382 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -141,34 +141,16 @@ jobs:
   name: airflow-website
   path: './dist'
   if-no-files-found: error
-  retention-days: 14
-  - name: Apply staging modifications
+  retention-days: 7
+  - name: "Apply staging modifications: .htaccess and watermarks"
 run: |
-  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' .htaccess
-  echo "Updated .htaccess"
-  cat .htaccess
+  set -x
+  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' ./dist/.htaccess
+  echo "Updated ./dist/.htaccess"
+  cat ./dist

(airflow-site) 01/01: Update watermark processing to use python script

2025-05-14 Thread potiuk
This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/airflow-site.git

commit 9ffd7c6341bed130348b74498f63dfa4c437db04
Author: Jarek Potiuk 
AuthorDate: Wed May 14 22:07:12 2025 +0100

Update watermark processing to use python script
---
 .github/scripts/add_watermark.py   |  81 +
 .../static => .github/scripts}/images/staging.png  | Bin
 .github/workflows/build.yml|  35 +++--
 3 files changed, 90 insertions(+), 26 deletions(-)

diff --git a/.github/scripts/add_watermark.py b/.github/scripts/add_watermark.py
new file mode 100755
index 00..2aad7aa764
--- /dev/null
+++ b/.github/scripts/add_watermark.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+#   "rich>=14.0.0",
+# ]
+# ///
+
+import shutil
+import argparse
+from pathlib import Path
+
+from rich.console import Console
+
+console = Console(width=200, color_system="standard")
+
+CSS_TO_ADD = """
+  body {
+  position: relative; /* Ensures the pseudo-element is positioned relative 
to the body */
+  z-index: 0; /* Keeps the content above the pseudo-element */
+  }
+
+  body::before {
+  content: "";
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background: url(URL_PREFIX/staging.png) repeat center center fixed; /* 
Sets the background image */
+  opacity: 0.2; /* Makes the watermark semi-transparent */
+  pointer-events: none; /* Ensures the watermark doesn't interfere with 
user interactions */
+  z-index: -1; /* Places the pseudo-element behind all other elements */
+  }
+"""
+
+IMAGE_FILE=Path(__file__).parent / "images" / "staging.png"
+
+if __name__ == "__main__":
+parser = argparse.ArgumentParser(description="Add watermark")
+parser.add_argument("--folder", required=True, help="Folder to look for 
css files for")
+parser.add_argument("--pattern", required=True, help="Glob pattern to look 
for")
+parser.add_argument("--url-prefix", required=True, help="URL prefix to use 
for the image")
+parser.add_argument("--image-directory", required=True,
+help="Image directory where image should be 
written-relative to folder path.")
+args = parser.parse_args()
+
+folder_path = Path(args.folder)
+pattern = args.pattern
+url_prefix = args.url_prefix
+image_directory_path = Path(args.image_directory)
+
+content_to_add = CSS_TO_ADD.replace("URL_PREFIX", url_prefix)
+
+files = folder_path.rglob(pattern)
+for file in files:
+content = file.read_text()
+if not "watermark semi-transparent" in content:
+console.print(f"[bright_blue]Adding watermark to:[/] {file}")
+content = content + content_to_add
+file.write_text(content)
+target_image_location = folder_path / image_directory_path
+target_image_location.mkdir(parents=True, exist_ok=True)
+shutil.copy(IMAGE_FILE, target_image_location / "staging.png")
diff --git a/landing-pages/site/static/images/staging.png 
b/.github/scripts/images/staging.png
similarity index 100%
rename from landing-pages/site/static/images/staging.png
rename to .github/scripts/images/staging.png
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ef11652df3..92e414553d 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -141,34 +141,16 @@ jobs:
   name: airflow-website
   path: './dist'
   if-no-files-found: error
-  retention-days: 14
-  - name: Apply staging modifications
+  retention-days: 7
+  - name: "Apply staging modifications: .htaccess and watermarks"
 run: |
-  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' .htaccess
-  echo "Updated .htaccess"
-  cat .htaccess
+  set -x
+  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' ./dist/.htaccess
+  echo "Updated ./dist/.htaccess"
+  cat ./dist

(airflow-site) 01/01: Update watermark processing to use python script

2025-05-14 Thread potiuk
This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/airflow-site.git

commit 4fc5fd0e2e37bb183f4616d819c7e3b0feaf3cf4
Author: Jarek Potiuk 
AuthorDate: Wed May 14 22:07:12 2025 +0100

Update watermark processing to use python script
---
 .github/scripts/add_watermark.py   |  81 +
 .../static => .github/scripts}/images/staging.png  | Bin
 .github/workflows/build.yml|  33 ++---
 3 files changed, 88 insertions(+), 26 deletions(-)

diff --git a/.github/scripts/add_watermark.py b/.github/scripts/add_watermark.py
new file mode 100755
index 00..2aad7aa764
--- /dev/null
+++ b/.github/scripts/add_watermark.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+#   "rich>=14.0.0",
+# ]
+# ///
+
+import shutil
+import argparse
+from pathlib import Path
+
+from rich.console import Console
+
+console = Console(width=200, color_system="standard")
+
+CSS_TO_ADD = """
+  body {
+  position: relative; /* Ensures the pseudo-element is positioned relative 
to the body */
+  z-index: 0; /* Keeps the content above the pseudo-element */
+  }
+
+  body::before {
+  content: "";
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background: url(URL_PREFIX/staging.png) repeat center center fixed; /* 
Sets the background image */
+  opacity: 0.2; /* Makes the watermark semi-transparent */
+  pointer-events: none; /* Ensures the watermark doesn't interfere with 
user interactions */
+  z-index: -1; /* Places the pseudo-element behind all other elements */
+  }
+"""
+
+IMAGE_FILE=Path(__file__).parent / "images" / "staging.png"
+
+if __name__ == "__main__":
+parser = argparse.ArgumentParser(description="Add watermark")
+parser.add_argument("--folder", required=True, help="Folder to look for 
css files for")
+parser.add_argument("--pattern", required=True, help="Glob pattern to look 
for")
+parser.add_argument("--url-prefix", required=True, help="URL prefix to use 
for the image")
+parser.add_argument("--image-directory", required=True,
+help="Image directory where image should be 
written-relative to folder path.")
+args = parser.parse_args()
+
+folder_path = Path(args.folder)
+pattern = args.pattern
+url_prefix = args.url_prefix
+image_directory_path = Path(args.image_directory)
+
+content_to_add = CSS_TO_ADD.replace("URL_PREFIX", url_prefix)
+
+files = folder_path.rglob(pattern)
+for file in files:
+content = file.read_text()
+if not "watermark semi-transparent" in content:
+console.print(f"[bright_blue]Adding watermark to:[/] {file}")
+content = content + content_to_add
+file.write_text(content)
+target_image_location = folder_path / image_directory_path
+target_image_location.mkdir(parents=True, exist_ok=True)
+shutil.copy(IMAGE_FILE, target_image_location / "staging.png")
diff --git a/landing-pages/site/static/images/staging.png 
b/.github/scripts/images/staging.png
similarity index 100%
rename from landing-pages/site/static/images/staging.png
rename to .github/scripts/images/staging.png
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ef11652df3..6f7544f15f 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -141,34 +141,15 @@ jobs:
   name: airflow-website
   path: './dist'
   if-no-files-found: error
-  retention-days: 14
-  - name: Apply staging modifications
+  retention-days: 7
+  - name: "Apply staging modifications: .htaccess and watermarks"
 run: |
-  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' .htaccess
-  echo "Updated .htaccess"
-  cat .htaccess
+  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' ./dist/.htaccess
+  echo "Updated ./dist/.htaccess"
+  cat ./dist/.htaccess
   

(airflow-site) 01/01: Update watermark processing to use python script

2025-05-14 Thread potiuk
This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/airflow-site.git

commit 3828dcf05c56845d655224c1f0ca0b8bd6f27251
Author: Jarek Potiuk 
AuthorDate: Wed May 14 22:07:12 2025 +0100

Update watermark processing to use python script
---
 .github/scripts/add_watermark.py   |  81 +
 .../static => .github/scripts}/images/staging.png  | Bin
 .github/workflows/build.yml|  33 ++---
 3 files changed, 88 insertions(+), 26 deletions(-)

diff --git a/.github/scripts/add_watermark.py b/.github/scripts/add_watermark.py
new file mode 100755
index 00..2aad7aa764
--- /dev/null
+++ b/.github/scripts/add_watermark.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+#   "rich>=14.0.0",
+# ]
+# ///
+
+import shutil
+import argparse
+from pathlib import Path
+
+from rich.console import Console
+
+console = Console(width=200, color_system="standard")
+
+CSS_TO_ADD = """
+  body {
+  position: relative; /* Ensures the pseudo-element is positioned relative 
to the body */
+  z-index: 0; /* Keeps the content above the pseudo-element */
+  }
+
+  body::before {
+  content: "";
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background: url(URL_PREFIX/staging.png) repeat center center fixed; /* 
Sets the background image */
+  opacity: 0.2; /* Makes the watermark semi-transparent */
+  pointer-events: none; /* Ensures the watermark doesn't interfere with 
user interactions */
+  z-index: -1; /* Places the pseudo-element behind all other elements */
+  }
+"""
+
+IMAGE_FILE=Path(__file__).parent / "images" / "staging.png"
+
+if __name__ == "__main__":
+parser = argparse.ArgumentParser(description="Add watermark")
+parser.add_argument("--folder", required=True, help="Folder to look for 
css files for")
+parser.add_argument("--pattern", required=True, help="Glob pattern to look 
for")
+parser.add_argument("--url-prefix", required=True, help="URL prefix to use 
for the image")
+parser.add_argument("--image-directory", required=True,
+help="Image directory where image should be 
written-relative to folder path.")
+args = parser.parse_args()
+
+folder_path = Path(args.folder)
+pattern = args.pattern
+url_prefix = args.url_prefix
+image_directory_path = Path(args.image_directory)
+
+content_to_add = CSS_TO_ADD.replace("URL_PREFIX", url_prefix)
+
+files = folder_path.rglob(pattern)
+for file in files:
+content = file.read_text()
+if not "watermark semi-transparent" in content:
+console.print(f"[bright_blue]Adding watermark to:[/] {file}")
+content = content + content_to_add
+file.write_text(content)
+target_image_location = folder_path / image_directory_path
+target_image_location.mkdir(parents=True, exist_ok=True)
+shutil.copy(IMAGE_FILE, target_image_location / "staging.png")
diff --git a/landing-pages/site/static/images/staging.png 
b/.github/scripts/images/staging.png
similarity index 100%
rename from landing-pages/site/static/images/staging.png
rename to .github/scripts/images/staging.png
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ef11652df3..489b25ded4 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -141,34 +141,15 @@ jobs:
   name: airflow-website
   path: './dist'
   if-no-files-found: error
-  retention-days: 14
-  - name: Apply staging modifications
+  retention-days: 7
+  - name: "Apply staging modifications: .htaccess and watermarks"
 run: |
-  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' .htaccess
-  echo "Updated .htaccess"
-  cat .htaccess
+  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' ./dist/.htaccess
+  echo "Updated ./dist/.htaccess"
+  cat ./dist/.htaccess
   

(airflow-site) 01/01: Update watermark processing to use python script

2025-05-14 Thread potiuk
This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/airflow-site.git

commit 76976c83da77aea50738c7ba8f14833df6ab2b24
Author: Jarek Potiuk 
AuthorDate: Wed May 14 22:07:12 2025 +0100

Update watermark processing to use python script
---
 .github/scripts/add_watermark.py   |  81 +
 .../static => .github/scripts}/images/staging.png  | Bin
 .github/workflows/build.yml|  33 ++---
 3 files changed, 88 insertions(+), 26 deletions(-)

diff --git a/.github/scripts/add_watermark.py b/.github/scripts/add_watermark.py
new file mode 100755
index 00..4b811ac4e0
--- /dev/null
+++ b/.github/scripts/add_watermark.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+#   "rich>=14.0.0",
+# ]
+# ///
+
+import shutil
+import argparse
+from pathlib import Path
+
+from rich.console import Console
+
+console = Console(width=200, color_system="standard")
+
+CSS_TO_ADD = """
+  body {
+  position: relative; /* Ensures the pseudo-element is positioned relative 
to the body */
+  z-index: 0; /* Keeps the content above the pseudo-element */
+  }
+
+  body::before {
+  content: "";
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background: url(URL_PREFIX/staging.png) repeat center center fixed; /* 
Sets the background image */
+  opacity: 0.2; /* Makes the watermark semi-transparent */
+  pointer-events: none; /* Ensures the watermark doesn't interfere with 
user interactions */
+  z-index: -1; /* Places the pseudo-element behind all other elements */
+  } 
+"""
+
+IMAGE_FILE=Path(__file__).parent / "images" / "staging.png"
+
+if __name__ == "__main__":
+parser = argparse.ArgumentParser(description="Add watermark")
+parser.add_argument("--folder", required=True, help="Folder to look for 
css files for")
+parser.add_argument("--pattern", required=True, help="Glob pattern to look 
for")
+parser.add_argument("--url-prefix", required=True, help="URL prefix to use 
for the image")
+parser.add_argument("--image-directory", required=True,
+help="Image directory where image should be 
written-relative to folder path.")
+args = parser.parse_args()
+
+folder_path = Path(args.folder)
+pattern = args.pattern
+url_prefix = args.url_prefix
+image_directory_path = Path(args.image_directory)
+
+content_to_add = CSS_TO_ADD.replace("URL_PREFIX", url_prefix)
+
+files = folder_path.rglob(pattern)
+for file in files:
+content = file.read_text()
+if not "watermark semi-transparent" in content:
+console.print(f"[bright_blue]Adding watermark to:[/] {file}")
+content = content + content_to_add
+file.write_text(content)
+target_image_location = folder_path / image_directory_path
+target_image_location.mkdir(parents=True, exist_ok=True)
+shutil.copy(IMAGE_FILE, target_image_location / "staging.png")
diff --git a/landing-pages/site/static/images/staging.png 
b/.github/scripts/images/staging.png
similarity index 100%
rename from landing-pages/site/static/images/staging.png
rename to .github/scripts/images/staging.png
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ef11652df3..489b25ded4 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -141,34 +141,15 @@ jobs:
   name: airflow-website
   path: './dist'
   if-no-files-found: error
-  retention-days: 14
-  - name: Apply staging modifications
+  retention-days: 7
+  - name: "Apply staging modifications: .htaccess and watermarks"
 run: |
-  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' .htaccess
-  echo "Updated .htaccess"
-  cat .htaccess
+  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' ./dist/.htaccess
+  echo "Updated ./dist/.htaccess"
+  cat ./dist/.htaccess
  

(airflow-site) 01/01: Update watermark processing to use python script

2025-05-14 Thread potiuk
This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch improve-live-staging
in repository https://gitbox.apache.org/repos/asf/airflow-site.git

commit 887939cca0cbb23d79bca45338f8d9bac664b837
Author: Jarek Potiuk 
AuthorDate: Wed May 14 22:07:12 2025 +0100

Update watermark processing to use python script
---
 .github/scripts/add_watermark.py   |  81 +
 .../static => .github/scripts}/images/staging.png  | Bin
 .github/workflows/build.yml|  33 ++---
 3 files changed, 88 insertions(+), 26 deletions(-)

diff --git a/.github/scripts/add_watermark.py b/.github/scripts/add_watermark.py
new file mode 100755
index 00..4b811ac4e0
--- /dev/null
+++ b/.github/scripts/add_watermark.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+#   "rich>=14.0.0",
+# ]
+# ///
+
+import shutil
+import argparse
+from pathlib import Path
+
+from rich.console import Console
+
+console = Console(width=200, color_system="standard")
+
+CSS_TO_ADD = """
+  body {
+  position: relative; /* Ensures the pseudo-element is positioned relative 
to the body */
+  z-index: 0; /* Keeps the content above the pseudo-element */
+  }
+
+  body::before {
+  content: "";
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background: url(URL_PREFIX/staging.png) repeat center center fixed; /* 
Sets the background image */
+  opacity: 0.2; /* Makes the watermark semi-transparent */
+  pointer-events: none; /* Ensures the watermark doesn't interfere with 
user interactions */
+  z-index: -1; /* Places the pseudo-element behind all other elements */
+  } 
+"""
+
+IMAGE_FILE=Path(__file__).parent / "images" / "staging.png"
+
+if __name__ == "__main__":
+parser = argparse.ArgumentParser(description="Add watermark")
+parser.add_argument("--folder", required=True, help="Folder to look for 
css files for")
+parser.add_argument("--pattern", required=True, help="Glob pattern to look 
for")
+parser.add_argument("--url-prefix", required=True, help="URL prefix to use 
for the image")
+parser.add_argument("--image-directory", required=True,
+help="Image directory where image should be 
written-relative to folder path.")
+args = parser.parse_args()
+
+folder_path = Path(args.folder)
+pattern = args.pattern
+url_prefix = args.url_prefix
+image_directory_path = Path(args.image_directory)
+
+content_to_add = CSS_TO_ADD.replace("URL_PREFIX", url_prefix)
+
+files = folder_path.rglob(pattern)
+for file in files:
+content = file.read_text()
+if not "watermark semi-transparent" in content:
+console.print(f"[bright_blue]Adding watermark to:[/] {file}")
+content = content + content_to_add
+file.write_text(content)
+target_image_location = folder_path / image_directory_path
+target_image_location.mkdir(parents=True, exist_ok=True)
+shutil.copy(IMAGE_FILE, target_image_location / "staging.png")
diff --git a/landing-pages/site/static/images/staging.png 
b/.github/scripts/images/staging.png
similarity index 100%
rename from landing-pages/site/static/images/staging.png
rename to .github/scripts/images/staging.png
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ef11652df3..489b25ded4 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -141,34 +141,15 @@ jobs:
   name: airflow-website
   path: './dist'
   if-no-files-found: error
-  retention-days: 14
-  - name: Apply staging modifications
+  retention-days: 7
+  - name: "Apply staging modifications: .htaccess and watermarks"
 run: |
-  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' .htaccess
-  echo "Updated .htaccess"
-  cat .htaccess
+  sed -i 
's/d7fnmbhf26p21.cloudfront.net/d3a2du7x0n8ydr.cloudfront.net/' ./dist/.htaccess
+  echo "Updated ./dist/.htaccess"
+  cat ./dist/.ht