Repository navigation
Fix: optimize website analytics overview SQL #156
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI / Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: 22 | |
| package-manager-cache: false | |
| - run: corepack enable pnpm | |
| - run: corepack prepare pnpm@10.33.1 --activate | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm lint | |
| typecheck: | |
| name: Typecheck | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: 22 | |
| package-manager-cache: false | |
| - run: corepack enable pnpm | |
| - run: corepack prepare pnpm@10.33.1 --activate | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm --filter @musiccloud/shared build | |
| - name: Shared | |
| run: pnpm exec tsc --noEmit --project packages/shared/tsconfig.json | |
| - name: Backend | |
| run: pnpm exec tsc --noEmit --project apps/backend/tsconfig.json | |
| - name: Frontend | |
| run: pnpm --filter @musiccloud/frontend exec astro check | |
| - name: Dashboard | |
| run: pnpm exec tsc --noEmit --project apps/dashboard/tsconfig.json | |
| - name: Tests | |
| run: pnpm -r --if-present test:run | |
| detect-changes: | |
| name: Detect Changes | |
| runs-on: ubuntu-latest | |
| needs: typecheck | |
| if: github.event_name == 'push' | |
| outputs: | |
| backend: ${{ steps.filter.outputs.backend }} | |
| frontend: ${{ steps.filter.outputs.frontend }} | |
| dashboard: ${{ steps.filter.outputs.dashboard }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Detect changed paths | |
| id: filter | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| before_sha="${{ github.event.before }}" | |
| head_sha="${{ github.sha }}" | |
| if [[ -z "$before_sha" || "$before_sha" == "0000000000000000000000000000000000000000" ]]; then | |
| mapfile -t changed_files < <(git ls-tree -r --name-only "$head_sha") | |
| else | |
| mapfile -t changed_files < <(git diff --name-only "$before_sha" "$head_sha") | |
| fi | |
| backend=false | |
| frontend=false | |
| dashboard=false | |
| for file in "${changed_files[@]}"; do | |
| case "$file" in | |
| apps/backend/*|packages/shared/*|package.json|pnpm-lock.yaml|pnpm-workspace.yaml|zerops.yml) | |
| backend=true ;; | |
| esac | |
| case "$file" in | |
| apps/frontend/*|packages/shared/*|package.json|pnpm-lock.yaml|pnpm-workspace.yaml|zerops.yml) | |
| frontend=true ;; | |
| esac | |
| case "$file" in | |
| apps/backend/*|apps/dashboard/*|packages/shared/*|package.json|pnpm-lock.yaml|pnpm-workspace.yaml|zerops.yml|.github/workflows/ci.yml) | |
| dashboard=true ;; | |
| esac | |
| done | |
| { | |
| echo "backend=$backend" | |
| echo "frontend=$frontend" | |
| echo "dashboard=$dashboard" | |
| } >> "$GITHUB_OUTPUT" | |
| deploy-backend: | |
| name: Deploy Backend | |
| runs-on: ubuntu-latest | |
| needs: detect-changes | |
| if: needs.detect-changes.outputs.backend == 'true' | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Zerops CLI | |
| run: | | |
| curl -fsSL https://github.com/zeropsio/zcli/releases/latest/download/zcli-linux-amd64 -o /usr/local/bin/zcli | |
| chmod +x /usr/local/bin/zcli | |
| - name: Deploy and wait | |
| env: | |
| ZEROPS_TOKEN: ${{ secrets.ZEROPS_TOKEN }} | |
| run: | | |
| zcli login "$ZEROPS_TOKEN" | |
| zcli push --serviceId vftiwXaYQGCnnwEEaiGPYA | |
| deploy-frontend: | |
| name: Deploy Frontend | |
| runs-on: ubuntu-latest | |
| needs: detect-changes | |
| if: needs.detect-changes.outputs.frontend == 'true' | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Zerops CLI | |
| run: | | |
| curl -fsSL https://github.com/zeropsio/zcli/releases/latest/download/zcli-linux-amd64 -o /usr/local/bin/zcli | |
| chmod +x /usr/local/bin/zcli | |
| - name: Deploy and wait | |
| env: | |
| ZEROPS_TOKEN: ${{ secrets.ZEROPS_TOKEN }} | |
| run: | | |
| zcli login "$ZEROPS_TOKEN" | |
| zcli push --serviceId bMY4g66BRDOfq1AAi8Q85A | |
| deploy-dashboard: | |
| name: Deploy Dashboard | |
| runs-on: ubuntu-latest | |
| needs: detect-changes | |
| if: needs.detect-changes.outputs.dashboard == 'true' | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Zerops CLI | |
| run: | | |
| curl -fsSL https://github.com/zeropsio/zcli/releases/latest/download/zcli-linux-amd64 -o /usr/local/bin/zcli | |
| chmod +x /usr/local/bin/zcli | |
| - name: Deploy and wait | |
| env: | |
| ZEROPS_TOKEN: ${{ secrets.ZEROPS_TOKEN }} | |
| run: | | |
| zcli login "$ZEROPS_TOKEN" | |
| zcli push --serviceId IF9Xp4YFRxuQKRQxmAWFBA |