diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..693cbf7 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +GTM_CONTAINER_ID=GTM-XXXXXXX diff --git a/.github/workflows/deploy-s3-dev.yml b/.github/workflows/deploy-s3-dev.yml index b0af28b..2237297 100644 --- a/.github/workflows/deploy-s3-dev.yml +++ b/.github/workflows/deploy-s3-dev.yml @@ -32,6 +32,8 @@ jobs: - name: Build static export run: npm run deploy + env: + GTM_CONTAINER_ID: ${{ secrets.DEV_GTM_CONTAINER_ID }} - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 diff --git a/.github/workflows/deploy-s3-prod.yml b/.github/workflows/deploy-s3-prod.yml index e40df15..ac52d20 100644 --- a/.github/workflows/deploy-s3-prod.yml +++ b/.github/workflows/deploy-s3-prod.yml @@ -42,6 +42,8 @@ jobs: - name: Build static export run: npm run deploy + env: + GTM_CONTAINER_ID: ${{ secrets.GTM_CONTAINER_ID }} - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 diff --git a/next.config.js b/next.config.js index 1fb5231..49c7c6e 100644 --- a/next.config.js +++ b/next.config.js @@ -5,5 +5,8 @@ module.exports = { "/deploy": { page: "/deploy" } }; }, - assetPrefix: "" + assetPrefix: "", + env: { + GTM_CONTAINER_ID: process.env.GTM_CONTAINER_ID + } }; diff --git a/pages/_app.js b/pages/_app.js index 66f96e7..51a6151 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -5,6 +5,7 @@ import Router from "next/router"; import { Provider } from "react-redux"; import initStore from "../src/store"; import Meta from "../src/components/Meta"; +import MigrationBanner from "../src/components/MigrationBanner"; class MyApp extends App { static async getInitialProps({ Component, ctx }) { @@ -22,6 +23,7 @@ class MyApp extends App { return ( + diff --git a/pages/_document.js b/pages/_document.js new file mode 100644 index 0000000..81097a8 --- /dev/null +++ b/pages/_document.js @@ -0,0 +1,37 @@ +import Document, { Html, Head, Main, NextScript } from "next/document"; + +class MyDocument extends Document { + // eslint-disable-next-line class-methods-use-this + render() { + return ( + + + {process.env.GTM_CONTAINER_ID && ( + // eslint-disable-next-line react/no-danger +