diff --git a/.github/workflows/deploy-frontend-azurepreview.yml b/.github/workflows/deploy-frontend-azurepreview.yml index ca259c1b9f..ff5fa44185 100644 --- a/.github/workflows/deploy-frontend-azurepreview.yml +++ b/.github/workflows/deploy-frontend-azurepreview.yml @@ -19,15 +19,24 @@ jobs: ######################################### branch-name: - runs-on: ubuntu-latest - outputs: - lowercase: ${{ steps.string.outputs.lowercase }} - - steps: - - id: string - uses: ASzc/change-string-case-action@v5 - with: - string: ${{ github.head_ref || github.ref_name }} + runs-on: ubuntu-latest + outputs: + lowercase: ${{ steps.string.outputs.lowercase }} + sanitized: ${{ steps.sanitize.outputs.sanitized }} + + steps: + - id: string + uses: ASzc/change-string-case-action@v5 + with: + string: ${{ github.head_ref || github.ref_name }} + + - name: sanitize branch name + id: sanitize + env: + RAW: ${{ steps.string.outputs.lowercase }} + run: | + CLEAN=$(printf '%s' "${RAW:0:12}" | sed 's/-*$//') + echo "sanitized=$CLEAN" >> $GITHUB_OUTPUT ######################################### # DETECT CHANGED SERVICES @@ -132,8 +141,8 @@ jobs: - name: Deploy Container App run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-website-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-website-preview" ENV_VARS="SECRET=${{ secrets.WEBSITE_SECRET }} API_URL=${{ secrets.WEBSITE_STAGE_API_URL }} OPENCAGE_API_KEY=${{ secrets.WEBSITE_STAGE_OPENCAGE_API_KEY }} API_TOKEN=${{ secrets.WEBSITE_STAGE_API_TOKEN }} SLACK_WEBHOOK_URL=${{ secrets.WEBSITE_STAGE_SLACK_WEBHOOK_URL }} SLACK_CHANNEL=${{ secrets.WEBSITE_STAGE_SLACK_CHANNEL }} NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN=${{ secrets.WEBSITE_STAGE_NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN }} NEXT_PUBLIC_GA_MEASUREMENT_ID=${{ secrets.WEBSITE_STAGE_NEXT_PUBLIC_GA_MEASUREMENT_ID }} GOOGLE_SITE_VERIFICATION=${{ secrets.WEBSITE_STAGE_GOOGLE_SITE_VERIFICATION }} NEXT_PUBLIC_SITE_URL=${{ secrets.WEBSITE_STAGE_NEXT_PUBLIC_SITE_URL }}" az containerapp up \ --name $APP \ @@ -149,8 +158,8 @@ jobs: - id: preview run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-website-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-website-preview" URL=$(az containerapp show \ --name $APP \ @@ -214,8 +223,8 @@ jobs: - name: Deploy Container App run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-beacon-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-beacon-preview" az containerapp up \ --name $APP \ @@ -231,8 +240,8 @@ jobs: - id: preview run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-beacon-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-beacon-preview" URL=$(az containerapp show \ --name $APP \ @@ -295,8 +304,8 @@ jobs: - name: Deploy Container App run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-calibrate-app-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-calibrate-app-preview" az containerapp up \ --name $APP \ @@ -312,8 +321,8 @@ jobs: - id: preview run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-calibrate-app-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-calibrate-app-preview" URL=$(az containerapp show \ --name $APP \ @@ -379,8 +388,8 @@ jobs: - name: Deploy Container App run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-analytics-p-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-analytics-p-preview" az containerapp up \ --name $APP \ @@ -396,8 +405,8 @@ jobs: - id: preview run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-analytics-p-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-analytics-p-preview" URL=$(az containerapp show \ --name $APP \ @@ -448,8 +457,8 @@ jobs: - name: Pull secrets from Key Vault run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-vertex-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-vertex-preview" DEFAULT_DOMAIN=$(az containerapp env show \ --name ${{ env.PR_PREVIEW_ENV }} \ @@ -477,8 +486,8 @@ jobs: - name: Deploy Container App run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-vertex-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-vertex-preview" mapfile -t ENV_VARS < <(jq -r 'to_entries[] | select(.key != "NEXTAUTH_URL" and .key != "NEXTAUTH_URL_INTERNAL" and .key != "NEXTAUTH_COOKIE_DOMAIN") | "\(.key)=\(.value|tostring)"' secrets.json) ENV_VARS+=("NEXTAUTH_URL=$NEXTAUTH_URL") @@ -530,8 +539,8 @@ jobs: - id: preview run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-vertex-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-vertex-preview" URL=$(az containerapp show \ --name $APP \ @@ -594,8 +603,8 @@ jobs: - name: Deploy Container App run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-docs-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-docs-preview" az containerapp up \ --name $APP \ @@ -611,8 +620,8 @@ jobs: - id: preview run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-docs-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-docs-preview" URL=$(az containerapp show \ --name $APP \ diff --git a/.github/workflows/remove-deploy-azurepreview.yml b/.github/workflows/remove-deploy-azurepreview.yml index bfc11e962c..ebf0c338ef 100644 --- a/.github/workflows/remove-deploy-azurepreview.yml +++ b/.github/workflows/remove-deploy-azurepreview.yml @@ -17,12 +17,21 @@ jobs: runs-on: ubuntu-latest outputs: lowercase: ${{ steps.string.outputs.lowercase }} + sanitized: ${{ steps.sanitize.outputs.sanitized }} steps: - id: string - uses: ASzc/change-string-case-action@v2 + uses: ASzc/change-string-case-action@v5 with: string: ${{ github.head_ref || github.ref_name }} + - name: sanitize branch name + id: sanitize + env: + RAW: ${{ steps.string.outputs.lowercase }} + run: | + CLEAN=$(printf '%s' "${RAW:0:12}" | sed 's/-*$//') + echo "sanitized=$CLEAN" >> $GITHUB_OUTPUT + check: name: check for available deploy previews outputs: @@ -44,8 +53,7 @@ jobs: - name: check modified services id: check_files run: | - - git diff --name-only HEAD^ HEAD > files.txt + git diff --name-only "origin/${{ github.base_ref }}"...HEAD > files.txt echo "remove_calibrate_app_preview=false" >>$GITHUB_OUTPUT echo "remove_analytics_platform=false" >>$GITHUB_OUTPUT @@ -56,31 +64,24 @@ jobs: while IFS= read -r file do - if [[ $file == src/calibrate/* ]]; then echo "remove_calibrate_app_preview=true" >>$GITHUB_OUTPUT fi - if [[ $file == src/platform/* ]]; then echo "remove_analytics_platform=true" >>$GITHUB_OUTPUT fi - if [[ $file == src/vertex/* ]]; then echo "remove_vertex=true" >>$GITHUB_OUTPUT fi - if [[ $file == src/beacon/* ]]; then echo "remove_beacon=true" >>$GITHUB_OUTPUT fi - if [[ $file == src/docs-website/* ]]; then echo "remove_docs=true" >>$GITHUB_OUTPUT fi - if [[ $file == src/website/* ]]; then echo "remove_website=true" >>$GITHUB_OUTPUT fi - done < files.txt ######################################################## @@ -101,8 +102,8 @@ jobs: - name: Delete Container App run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-calibrate-app-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-calibrate-app-preview" az containerapp delete \ --name $APP \ @@ -126,10 +127,9 @@ jobs: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Delete Container App - run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-analytics-p-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-analytics-p-preview" az containerapp delete \ --name $APP \ @@ -154,8 +154,8 @@ jobs: - name: Delete Container App run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-website-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-website-preview" az containerapp delete \ --name $APP \ @@ -180,8 +180,8 @@ jobs: - name: Delete Container App run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-vertex-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-vertex-preview" az containerapp delete \ --name $APP \ @@ -206,8 +206,8 @@ jobs: - name: Delete Container App run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-beacon-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-beacon-preview" az containerapp delete \ --name $APP \ @@ -232,8 +232,8 @@ jobs: - name: Delete Container App run: | - BRANCH="${{ needs.branch-name.outputs.lowercase }}" - APP="${BRANCH:0:12}-docs-preview" + BRANCH="${{ needs.branch-name.outputs.sanitized }}" + APP="${BRANCH}-docs-preview" az containerapp delete \ --name $APP \ diff --git a/src/beacon/README.md b/src/beacon/README.md index 5afe26376d..6916810613 100644 --- a/src/beacon/README.md +++ b/src/beacon/README.md @@ -1,4 +1,4 @@ -# AirQo Device Health Monitoring Frontend. +# AirQo Device Health Monitoring Frontend ## Node.js Version Requirement This project requires **Node.js v22.x**. Please ensure you are using Node.js 22 for development and production environments. diff --git a/src/docs-website/README.md b/src/docs-website/README.md index b8f8bd2780..df2152c921 100644 --- a/src/docs-website/README.md +++ b/src/docs-website/README.md @@ -1,4 +1,4 @@ -# AirQo Digital Products Documentation . +# AirQo Digital Products Documentation This repository hosts the centralized documentation hub for all AirQo digital products, including Analytics, Vertex, Beacon, AI Platform, and the API. It is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. diff --git a/src/platform/README.md b/src/platform/README.md index cb624566af..8697c1056f 100644 --- a/src/platform/README.md +++ b/src/platform/README.md @@ -1,6 +1,6 @@ This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). -## Getting Started +## Getting Started. First, run the development server: diff --git a/src/vertex/README.md b/src/vertex/README.md index b93c13aea4..52e53f4caf 100644 --- a/src/vertex/README.md +++ b/src/vertex/README.md @@ -1,4 +1,4 @@ -# Vertex (Web App) +# Vertex (Web App). `vertex` is the AirQo web application for Device and Network management. diff --git a/src/website/README.md b/src/website/README.md index f6ed2e4108..e73b563160 100644 --- a/src/website/README.md +++ b/src/website/README.md @@ -1,4 +1,4 @@ -# Website. +# Website Welcome to the Website repository, part of the AirQo Frontend project. This website is built with [Next.js](https://nextjs.org) and was bootstrapped using [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). The live website can be found at [airqo.net](https://airqo.net)