diff --git a/.env.example b/.env.example index 0fde896bb5..55a5c880f2 100644 --- a/.env.example +++ b/.env.example @@ -30,6 +30,7 @@ FRESHDESK_API_URL= FRESHDESK_API_TOKEN= # [Optional] analytics.mudita.com +ANALYTICS_ENABLED= ANALYTICS_API_URL= ANALYTICS_API_SITE_ID= diff --git a/.github/workflows/nexus-development.yml b/.github/workflows/nexus-development.yml index e9594bd2a9..5e48e734e2 100644 --- a/.github/workflows/nexus-development.yml +++ b/.github/workflows/nexus-development.yml @@ -1,4 +1,4 @@ -name: Build and push artifacts to nexus +name: Build & deploy to development on: push: @@ -32,6 +32,7 @@ jobs: FONTS_DIRECTORY_URL: ${{ secrets.FONTS_DIRECTORY_URL }} FRESHDESK_API_URL: ${{ secrets.FRESHDESK_API_URL }} FRESHDESK_API_TOKEN: ${{ secrets.FRESHDESK_API_TOKEN }} + ANALYTICS_ENABLED: ${{ secrets.ANALYTICS_ENABLED }} ANALYTICS_API_URL: ${{ secrets.ANALYTICS_API_URL }} ANALYTICS_API_SITE_ID: ${{ secrets.ANALYTICS_API_SITE_ID }} FEATURE_TOGGLE_ENVIRONMENT: ${{ secrets.FEATURE_TOGGLE_ENVIRONMENT }} @@ -48,15 +49,19 @@ jobs: NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} run: | - export APP_VERSION=`echo -n v && cat packages/app/package.json | jq -r .version` + export APP_VERSION=`cat packages/app/package.json | jq -r .version` export SOURCE_BRANCH=${{ github.ref_name }} - export "BUILD_VERSION=-dev.${{ github.run_number }}" if [[ $SOURCE_BRANCH == "develop" ]]; then export ENVIVORMENT_CATALOG_NAME=development + export "BUILD_VERSION=-dev.${{ github.run_number }}" else export "ENVIVORMENT_CATALOG_NAME=feature-branch/${{ github.ref_name }}" + export "BUILD_VERSION=.${{ github.run_number }}" fi - export APP_VERSION=`echo -n v && cat packages/app/package.json | jq -r .version` + echo "GITTAG=$APP_VERSION$BUILD_VERSION" >> $GITHUB_ENV + export GITTAG="$APP_VERSION$BUILD_VERSION" + git tag "$GITTAG" + git push origin "$GITTAG" curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/Mudita-Center.exe https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION$BUILD_VERSION/Mudita-Center.exe curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/Mudita-Center.AppImage https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION$BUILD_VERSION/Mudita-Center.AppImage curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/Mudita-Center.dmg https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION$BUILD_VERSION/Mudita-Center.dmg @@ -68,4 +73,45 @@ jobs: curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/latest-mac.yml https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION$BUILD_VERSION/latest-mac.yml curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/latest.yml https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION$BUILD_VERSION/latest.yml curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/builder-debug.yml https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION$BUILD_VERSION/builder-debug.yml - + git clone https://${{ secrets.MC_GITHUB_ACCESS_TOKEN }}@github.com/mudita/mudita-center-internal-releases.git + cd mudita-center-internal-releases + git tag "$GITTAG" + git push origin "$GITTAG" + - name: Create draft release + id: create_release + uses: softprops/action-gh-release@v1 + with: + files: | + ./packages/app/release/Mudita-Center.exe + ./packages/app/release/Mudita-Center.AppImage + ./packages/app/release/Mudita-Center.dmg + ./packages/app/release/Mudita-Center.zip + ./packages/app/release/Mudita-Center.zip.blockmap + ./packages/app/release/Mudita-Center.exe.blockmap + ./packages/app/release/Mudita-Center.dmg.blockmap + ./packages/app/release/latest-linux.yml + ./packages/app/release/latest-mac.yml + ./packages/app/release/latest.yml + ./packages/app/release/builder-debug.yml + tag_name: ${{ env.GITTAG }} + name: Mudita Center v${{ env.GITTAG }} + repository: mudita/mudita-center-internal-releases + token: ${{ secrets.MC_GITHUB_ACCESS_TOKEN }} + prerelease: true + - name: Push artifacts to GitHub + id: upload_assets + uses: actions/upload-artifact@v2 + with: + name: release-assets + path: | + ./packages/app/release/Mudita-Center.exe + ./packages/app/release/Mudita-Center.AppImage + ./packages/app/release/Mudita-Center.dmg + ./packages/app/release/Mudita-Center.zip + ./packages/app/release/Mudita-Center.zip.blockmap + ./packages/app/release/Mudita-Center.exe.blockmap + ./packages/app/release/Mudita-Center.dmg.blockmap + ./packages/app/release/latest-linux.yml + ./packages/app/release/latest-mac.yml + ./packages/app/release/latest.yml + ./packages/app/release/builder-debug.yml diff --git a/.github/workflows/nexus-pre-production.yml b/.github/workflows/nexus-pre-production.yml index ae3e836d89..94553fec59 100644 --- a/.github/workflows/nexus-pre-production.yml +++ b/.github/workflows/nexus-pre-production.yml @@ -1,4 +1,4 @@ -name: Build and push artifacts to nexus +name: Build & deploy to pre-production on: push: @@ -33,6 +33,7 @@ jobs: FONTS_DIRECTORY_URL: ${{ secrets.FONTS_DIRECTORY_URL }} FRESHDESK_API_URL: ${{ secrets.FRESHDESK_API_URL }} FRESHDESK_API_TOKEN: ${{ secrets.FRESHDESK_API_TOKEN }} + ANALYTICS_ENABLED: ${{ secrets.ANALYTICS_ENABLED }} ANALYTICS_API_URL: ${{ secrets.ANALYTICS_API_URL }} ANALYTICS_API_SITE_ID: ${{ secrets.ANALYTICS_API_SITE_ID }} FEATURE_TOGGLE_ENVIRONMENT: ${{ secrets.FEATURE_TOGGLE_ENVIRONMENT }} @@ -50,7 +51,9 @@ jobs: NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} run: | export ENVIVORMENT_CATALOG_NAME=pre-production - export APP_VERSION=`echo -n v && cat packages/app/package.json | jq -r .version` + export APP_VERSION=`cat packages/app/package.json | jq -r .version` + echo "GITTAG=$APP_VERSION" >> $GITHUB_ENV + export GITTAG="$APP_VERSION" curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/Mudita-Center.exe https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION/Mudita-Center.exe curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/Mudita-Center.AppImage https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION/Mudita-Center.AppImage curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/Mudita-Center.dmg https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION/Mudita-Center.dmg @@ -62,4 +65,44 @@ jobs: curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/latest-mac.yml https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION/latest-mac.yml curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/latest.yml https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION/latest.yml curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/builder-debug.yml https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION/builder-debug.yml - + git clone https://${{ secrets.MC_GITHUB_ACCESS_TOKEN }}@github.com/mudita/mudita-center-internal-releases.git + cd mudita-center-internal-releases + git tag "$GITTAG" + git push origin "$GITTAG" + - name: Create draft release on internal repository + id: create_release + uses: softprops/action-gh-release@v1 + with: + files: | + ./packages/app/release/Mudita-Center.exe + ./packages/app/release/Mudita-Center.AppImage + ./packages/app/release/Mudita-Center.dmg + ./packages/app/release/Mudita-Center.zip + ./packages/app/release/Mudita-Center.zip.blockmap + ./packages/app/release/Mudita-Center.exe.blockmap + ./packages/app/release/Mudita-Center.dmg.blockmap + ./packages/app/release/latest-linux.yml + ./packages/app/release/latest-mac.yml + ./packages/app/release/latest.yml + ./packages/app/release/builder-debug.yml + name: Mudita Center ${{ env.GITTAG }} + tag_name: ${{ env.GITTAG }} + repository: mudita/mudita-center-internal-releases + token: ${{ secrets.MC_GITHUB_ACCESS_TOKEN }} + - name: Push artifacts to github + id: upload_assets + uses: actions/upload-artifact@v2 + with: + name: release-assets + path: | + ./packages/app/release/Mudita-Center.exe + ./packages/app/release/Mudita-Center.AppImage + ./packages/app/release/Mudita-Center.dmg + ./packages/app/release/Mudita-Center.zip + ./packages/app/release/Mudita-Center.zip.blockmap + ./packages/app/release/Mudita-Center.exe.blockmap + ./packages/app/release/Mudita-Center.dmg.blockmap + ./packages/app/release/latest-linux.yml + ./packages/app/release/latest-mac.yml + ./packages/app/release/latest.yml + ./packages/app/release/builder-debug.yml diff --git a/.github/workflows/nexus-production.yml b/.github/workflows/nexus-production.yml index 46a162b13a..0b740cafc7 100644 --- a/.github/workflows/nexus-production.yml +++ b/.github/workflows/nexus-production.yml @@ -1,4 +1,4 @@ -name: Build and push artifacts to nexus +name: Build & deploy to production on: push: @@ -33,6 +33,7 @@ jobs: FONTS_DIRECTORY_URL: ${{ secrets.FONTS_DIRECTORY_URL }} FRESHDESK_API_URL: ${{ secrets.FRESHDESK_API_URL }} FRESHDESK_API_TOKEN: ${{ secrets.FRESHDESK_API_TOKEN }} + ANALYTICS_ENABLED: ${{ secrets.ANALYTICS_ENABLED }} ANALYTICS_API_URL: ${{ secrets.ANALYTICS_API_URL }} ANALYTICS_API_SITE_ID: ${{ secrets.ANALYTICS_API_SITE_ID }} FEATURE_TOGGLE_ENVIRONMENT: ${{ secrets.FEATURE_TOGGLE_ENVIRONMENT }} @@ -50,7 +51,8 @@ jobs: NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} run: | export ENVIVORMENT_CATALOG_NAME=production - export APP_VERSION=`echo -n v && cat packages/app/package.json | jq -r .version` + export APP_VERSION=`cat packages/app/package.json | jq -r .version` + echo "GITTAG=$APP_VERSION" >> $GITHUB_ENV curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/Mudita-Center.exe https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION/Mudita-Center.exe curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/Mudita-Center.AppImage https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION/Mudita-Center.AppImage curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/Mudita-Center.dmg https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION/Mudita-Center.dmg @@ -62,4 +64,40 @@ jobs: curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/latest-mac.yml https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION/latest-mac.yml curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/latest.yml https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION/latest.yml curl -v -u $NEXUS_USERNAME:$NEXUS_PASSWORD --upload-file ./packages/app/release/builder-debug.yml https://nexus.mudita.com/repository/mudita-center/releases/$ENVIVORMENT_CATALOG_NAME/$APP_VERSION/builder-debug.yml - + - name: Create draft release + id: create_release + uses: softprops/action-gh-release@v1 + with: + files: | + ./packages/app/release/Mudita-Center.exe + ./packages/app/release/Mudita-Center.AppImage + ./packages/app/release/Mudita-Center.dmg + ./packages/app/release/Mudita-Center.zip + ./packages/app/release/Mudita-Center.zip.blockmap + ./packages/app/release/Mudita-Center.exe.blockmap + ./packages/app/release/Mudita-Center.dmg.blockmap + ./packages/app/release/latest-linux.yml + ./packages/app/release/latest-mac.yml + ./packages/app/release/latest.yml + ./packages/app/release/builder-debug.yml + tag_name: ${{ env.GITTAG }} + name: Mudita Center v${{ env.GITTAG }} + token: ${{ secrets.MC_GITHUB_ACCESS_TOKEN }} + draft: true + - name: Push artifacts to GitHub + id: upload_assets + uses: actions/upload-artifact@v2 + with: + name: release-assets + path: | + ./packages/app/release/Mudita-Center.exe + ./packages/app/release/Mudita-Center.AppImage + ./packages/app/release/Mudita-Center.dmg + ./packages/app/release/Mudita-Center.zip + ./packages/app/release/Mudita-Center.zip.blockmap + ./packages/app/release/Mudita-Center.exe.blockmap + ./packages/app/release/Mudita-Center.dmg.blockmap + ./packages/app/release/latest-linux.yml + ./packages/app/release/latest-mac.yml + ./packages/app/release/latest.yml + ./packages/app/release/builder-debug.yml diff --git a/packages/app/src/analytic-data-tracker/services/analytic-data-tracker.factory.ts b/packages/app/src/analytic-data-tracker/services/analytic-data-tracker.factory.ts index 713851cb8f..c9390bf77a 100644 --- a/packages/app/src/analytic-data-tracker/services/analytic-data-tracker.factory.ts +++ b/packages/app/src/analytic-data-tracker/services/analytic-data-tracker.factory.ts @@ -64,7 +64,8 @@ export class AnalyticDataTrackerFactory { const appSettings = settingsService.getSettings() const _id = appSettings.applicationId - const trackingEnabled = appSettings.privacyPolicyAccepted + const trackingEnabled = + appSettings.privacyPolicyAccepted && process.env.ANALYTICS_ENABLED === "1" const axiosInstance: AxiosInstance = axios.create({ httpsAgent: new https.Agent({