diff --git a/.github/workflows/s3.yml b/.github/workflows/s3.yml index 92447480..327e0e31 100644 --- a/.github/workflows/s3.yml +++ b/.github/workflows/s3.yml @@ -2,38 +2,30 @@ name: Deploy to S3 on: push: - branches: [ "main", "develop" ] + branches: ["main", "develop"] workflow_dispatch: jobs: - build: environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'development' }} permissions: contents: read runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: 'npm' - - run: npm install - - name: create env file - run: | - touch .env - echo TYPESENSE_COLLECTION_NAME=${{ vars.TYPESENSE_COLLECTION_NAME }} >> .env - echo TYPESENSE_SERVER_HOST=${{ vars.TYPESENSE_SERVER_HOST }} >> .env - echo TYPESENSE_SEARCH_ONLY_APIKEY=${{ vars.TYPESENSE_SEARCH_ONLY_APIKEY }} >> .env - echo HOTJAR_ID=${{ vars.HOTJAR_ID }} >> .env - - run: npm run build - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ap-northeast-1 - - - name: Sync to S3 - run: aws s3 sync ./build s3://${{ secrets.AWS_S3_BUCKET }} + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: "npm" + - run: npm install + - run: npm run build + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ap-northeast-1 + + - name: Sync to S3 + run: aws s3 sync ./build s3://${{ secrets.AWS_S3_BUCKET }} diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 8d6ca7c2..e8fdf660 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -35,8 +35,6 @@ const config: Config = { defaultLocale: "en", locales: ["en"], }, - - plugins: ["docusaurus-plugin-hotjar"], presets: [ [ "classic", @@ -110,9 +108,6 @@ const config: Config = { apiKey: "0e3c2389292b3d211032f3843fa8eb6d", indexName: "aelf", }, - hotjar: { - applicationId: process.env.HOTJAR_ID, - }, } satisfies Preset.ThemeConfig, stylesheets: [ { diff --git a/package-lock.json b/package-lock.json index 9b05b1b4..3709b6d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,13 +17,13 @@ "@sinm/react-file-tree": "^1.1.1", "chaingpt-component": "^0.2.0-beta.3", "clsx": "^2.0.0", - "docusaurus-plugin-hotjar": "^0.0.2", "dotenv": "^16.4.5", "prism-react-renderer": "^2.3.0", "react": "^18.0.0", "react-dom": "^18.0.0", "react-ga4": "^2.1.0", "react-gtm-module": "^2.0.11", + "react-hotjar": "^6.3.1", "rehype-katex": "^7.0.0", "remark-math": "^6.0.0" }, @@ -5780,12 +5780,6 @@ "node": ">=6" } }, - "node_modules/docusaurus-plugin-hotjar": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/docusaurus-plugin-hotjar/-/docusaurus-plugin-hotjar-0.0.2.tgz", - "integrity": "sha512-Jsdxa6k4YQm4SBiY5mv9h/6sKUrQs6lC6mRoPUfjiPVtnhURE3d0dj4Vnrpy/tRVSAbywAqA0F/PGn5RKHtVaw==", - "license": "MIT" - }, "node_modules/dom-converter": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz", @@ -12403,6 +12397,12 @@ "react-dom": "^16.6.0 || ^17.0.0 || ^18.0.0" } }, + "node_modules/react-hotjar": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/react-hotjar/-/react-hotjar-6.3.1.tgz", + "integrity": "sha512-EwMqL+ROSlKzatMhT/aqRq7XWWfzlnHynSBSTJh5M2O78mBiPohiSl4Ysls3HOQkkD9y6L22BW0c9bxK2JguwQ==", + "license": "MIT" + }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", diff --git a/package.json b/package.json index ee112653..40eaa32a 100644 --- a/package.json +++ b/package.json @@ -24,13 +24,13 @@ "@sinm/react-file-tree": "^1.1.1", "chaingpt-component": "^0.2.0-beta.3", "clsx": "^2.0.0", - "docusaurus-plugin-hotjar": "^0.0.2", "dotenv": "^16.4.5", "prism-react-renderer": "^2.3.0", "react": "^18.0.0", "react-dom": "^18.0.0", "react-ga4": "^2.1.0", "react-gtm-module": "^2.0.11", + "react-hotjar": "^6.3.1", "rehype-katex": "^7.0.0", "remark-math": "^6.0.0" }, diff --git a/src/theme/analytics.ts b/src/theme/analytics.ts index 951a759a..302ade1b 100644 --- a/src/theme/analytics.ts +++ b/src/theme/analytics.ts @@ -3,6 +3,7 @@ import { gaEventsForwarderPlugin } from "@amplitude/plugin-ga-events-forwarder-b import { sessionReplayPlugin } from "@amplitude/plugin-session-replay-browser"; import ReactGA from "react-ga4"; import TagManager from "react-gtm-module"; +import { hotjar } from "react-hotjar"; export const analytics = () => { const gaEventsForwarder = gaEventsForwarderPlugin(); @@ -13,6 +14,7 @@ export const analytics = () => { }); amplitude.add(sessionReplayTracking); + hotjar.initialize({ id: 5101939, sv: 6 }); ReactGA.initialize("G-PFZ0BCQHMY"); TagManager.initialize({ gtmId: "GTM-NKWDMQ52",