From efa65c482247cb3e455c75f94f83d1069566c24e Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Tue, 7 Nov 2023 22:48:13 +0700 Subject: [PATCH 1/4] Integrate google tag manager --- docs/docusaurus.config.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index eae2d56093..e3b03f7689 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -81,6 +81,11 @@ const config = { theme: { customCss: require.resolve("./src/styles/main.scss"), }, + // GTM is always inactive in development and only active in production to avoid polluting the analytics statistics. + // Will Replace container ID later once already create + googleTagManager: { + containerId: "GTM-12345", + }, // Will be passed to @docusaurus/plugin-content-pages (false to disable) // pages: {}, }), From 2a787349624c30b4361dde84177d293271f25492 Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Tue, 7 Nov 2023 23:08:26 +0700 Subject: [PATCH 2/4] Update container id google tag manager --- docs/docusaurus.config.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index e3b03f7689..63aac1557d 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -82,9 +82,8 @@ const config = { customCss: require.resolve("./src/styles/main.scss"), }, // GTM is always inactive in development and only active in production to avoid polluting the analytics statistics. - // Will Replace container ID later once already create googleTagManager: { - containerId: "GTM-12345", + containerId: "GTM-59R6474K", }, // Will be passed to @docusaurus/plugin-content-pages (false to disable) // pages: {}, From 5e9edc316c924b9da81b53265a69c675ccb5c1e5 Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Sat, 11 Nov 2023 17:43:25 +0700 Subject: [PATCH 3/4] Change GTM ID via .env --- docs/docusaurus.config.js | 4 +++- docs/package.json | 1 + docs/yarn.lock | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 63aac1557d..499c821105 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -1,6 +1,8 @@ // @ts-check // Note: type annotations allow type checking and IDEs autocompletion +require("dotenv").config(); + const lightCodeTheme = require("prism-react-renderer/themes/github"); const darkCodeTheme = require("prism-react-renderer/themes/dracula"); @@ -83,7 +85,7 @@ const config = { }, // GTM is always inactive in development and only active in production to avoid polluting the analytics statistics. googleTagManager: { - containerId: "GTM-59R6474K", + containerId: process.env.GTM_ID, }, // Will be passed to @docusaurus/plugin-content-pages (false to disable) // pages: {}, diff --git a/docs/package.json b/docs/package.json index 002b47321c..7bd63ea849 100644 --- a/docs/package.json +++ b/docs/package.json @@ -37,6 +37,7 @@ }, "devDependencies": { "@docusaurus/module-type-aliases": "2.4.1", + "dotenv": "^16.3.1", "tailwindcss-animate": "^1.0.7" }, "browserslist": { diff --git a/docs/yarn.lock b/docs/yarn.lock index 8063e076bb..b02370470d 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -4939,6 +4939,11 @@ dot-prop@^6.0.1: dependencies: is-obj "^2.0.0" +dotenv@^16.3.1: + version "16.3.1" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e" + integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ== + duplexer3@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.5.tgz#0b5e4d7bad5de8901ea4440624c8e1d20099217e" From e31bc6d452e2702400ba4e4f09e169f334980994 Mon Sep 17 00:00:00 2001 From: Service Account Date: Mon, 13 Nov 2023 15:22:52 +0700 Subject: [PATCH 4/4] Update CICD to fill secret to .env file jan docs --- .github/workflows/jan-docs.yml | 19 +++++++++++++++++++ docs/.env.example | 1 + docs/README.md | 1 + 3 files changed, 21 insertions(+) create mode 100644 docs/.env.example diff --git a/.github/workflows/jan-docs.yml b/.github/workflows/jan-docs.yml index 20b9c528f8..afb8ac463a 100644 --- a/.github/workflows/jan-docs.yml +++ b/.github/workflows/jan-docs.yml @@ -25,6 +25,25 @@ jobs: with: node-version: 18 + - name: Install jq + uses: dcarbone/install-jq-action@v2.0.1 + + - name: Fill env vars + run: | + env_example_file=".env.example" + touch .env + while IFS= read -r line || [[ -n "$line" ]]; do + if [[ "$line" == *"="* ]]; then + var_name=$(echo $line | cut -d '=' -f 1) + echo $var_name + var_value="$(jq -r --arg key "$var_name" '.[$key]' <<< "$SECRETS")" + echo "$var_name=$var_value" >> .env + fi + done < "$env_example_file" + working-directory: docs + env: + SECRETS: '${{ toJson(secrets) }}' + - name: Install dependencies run: yarn install working-directory: docs diff --git a/docs/.env.example b/docs/.env.example new file mode 100644 index 0000000000..4048b604cb --- /dev/null +++ b/docs/.env.example @@ -0,0 +1 @@ +GTM_ID=xxxx \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index f516942cbd..1bd3933d6e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -11,6 +11,7 @@ $ yarn ### Local Development ``` +$ cp .env.example .env $ yarn start ```