From 3d941e2b0538cbbb0ae3ac46083075322295e2c8 Mon Sep 17 00:00:00 2001 From: Ayaka Date: Mon, 2 Dec 2024 04:43:54 +0000 Subject: [PATCH] Add Cloudflare analytics --- .github/workflows/build.yml | 4 +++- .github/workflows/documentation.yml | 4 +++- inject_cf_analytics.sh | 8 ++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100755 inject_cf_analytics.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db46dd4..0be3671 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,4 +37,6 @@ jobs: - name: Test run: npm test - name: Build documentation - run: npm run doc:html + run: | + npm run doc:html + ./inject_cf_analytics.sh diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 759710c..ed08144 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -25,7 +25,9 @@ jobs: - name: Build run: npm run build - name: Build documentation - run: npm run doc:html + run: | + npm run doc:html + ./inject_cf_analytics.sh - name: Publish run: | # Create a temporary directory diff --git a/inject_cf_analytics.sh b/inject_cf_analytics.sh new file mode 100755 index 0000000..a449150 --- /dev/null +++ b/inject_cf_analytics.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +TARGET_DIR="./docs" +SCRIPT="" + +find "$TARGET_DIR" -type f -name "*.html" | while read -r FILE; do + sed -i "s||$SCRIPT|g" "$FILE" +done