add and setup plausible

This commit is contained in:
Dawid Wysokiński 2021-11-07 08:40:51 +01:00
parent 43d7539a19
commit 81cdbaa245
Signed by: Kichiyaki
GPG Key ID: EF14026D247EB867
5 changed files with 17 additions and 5 deletions

View File

@ -39,12 +39,15 @@ jobs:
with:
context: .
build-args: |
ENABLE_SENTRY=true
SENTRY_ENABLED=true
SENTRY_URL=${{ secrets.SENTRY_URL }}
SENTRY_ORG=${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT=${{ secrets.SENTRY_PROJECT }}
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_DSN=${{ secrets.SENTRY_DSN }}
PLAUSIBLE_ENABLED=true
PLAUSIBLE_DOMAIN=${{ secrets.PLAUSIBLE_DOMAIN }}
PLAUSIBLE_SCRIPT_SRC=${{ secrets.PLAUSIBLE_SCRIPT_SRC }}
VERSION=v${{ steps.get_version.outputs.VERSION }}
tags: |
${{ secrets.REGISTRY_NAME }}/twhelp-version-website:latest

View File

@ -9,19 +9,25 @@ RUN yarn
COPY . ./
ARG VERSION="v0.0.0"
ARG ENABLE_SENTRY="false"
ARG SENTRY_ENABLED="false"
ARG SENTRY_URL=""
ARG SENTRY_ORG=""
ARG SENTRY_PROJECT=""
ARG SENTRY_AUTH_TOKEN=""
ARG SENTRY_DSN=""
ARG PLAUSIBLE_ENABLED="false"
ARG PLAUSIBLE_DOMAIN=""
ARG PLAUSIBLE_SCRIPT_SRC=""
ENV REACT_APP_ENABLE_SENTRY=$ENABLE_SENTRY \
ENV REACT_APP_SENTRY_ENABLED=$SENTRY_ENABLED \
SENTRY_URL=$SENTRY_URL \
SENTRY_ORG=$SENTRY_ORG \
SENTRY_PROJECT=$SENTRY_PROJECT \
SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN \
REACT_APP_SENTRY_DSN=$SENTRY_DSN \
REACT_APP_PLAUSIBLE_ENABLED=$PLAUSIBLE_ENABLED \
REACT_APP_PLAUSIBLE_DOMAIN=$PLAUSIBLE_DOMAIN \
REACT_APP_PLAUSIBLE_SCRIPT_SRC=$PLAUSIBLE_SCRIPT_SRC \
REACT_APP_VERSION=$VERSION \
NODE_ENV=production

View File

@ -1,7 +1,7 @@
const SentryCli = require('@sentry/cli');
async function createReleaseAndUpload() {
if (process.env.REACT_APP_ENABLE_SENTRY !== 'true') {
if (process.env.REACT_APP_SENTRY_ENABLED !== 'true') {
return;
}

View File

@ -26,6 +26,9 @@
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<% if (process.env.REACT_APP_PLAUSIBLE_ENABLED === 'true') { %>
<script defer async data-domain="%REACT_APP_PLAUSIBLE_DOMAIN%" src="%REACT_APP_PLAUSIBLE_SCRIPT_SRC%"></script>
<% } %>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.

View File

@ -2,7 +2,7 @@ import * as Sentry from '@sentry/react';
import { Integrations } from '@sentry/tracing';
const initSentry = () => {
if (process.env.REACT_APP_ENABLE_SENTRY !== 'true') {
if (process.env.REACT_APP_SENTRY_ENABLED !== 'true') {
return;
}