fix: use gtag API for GA4 event tracking #75
Workflow file for this run
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 | |
| on: | |
| pull_request: | |
| branches: [dev] | |
| jobs: | |
| validate-branch: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check branch prefix | |
| run: | | |
| BRANCH="${{ github.head_ref }}" | |
| VALID_PREFIXES="feat/|feature/|fix/|chore/|refactor/|style/|perf/|test/|docs/|ci/|build/|revert/|major/" | |
| if [[ ! "$BRANCH" =~ ^($VALID_PREFIXES) ]]; then | |
| echo "::error::Invalid branch prefix. Branch must start with: feat/, fix/, chore/, refactor/, style/, perf/, test/, docs/, ci/, build/, revert/, or major/" | |
| exit 1 | |
| fi | |
| echo "Branch prefix valid: $BRANCH" | |
| validate-version: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Get version from PR branch | |
| id: pr_version | |
| run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
| - name: Get version from dev branch | |
| id: dev_version | |
| run: | | |
| git fetch origin dev | |
| DEV_VERSION=$(git show origin/dev:package.json | node -p "JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf8')).version") | |
| echo "version=$DEV_VERSION" >> $GITHUB_OUTPUT | |
| - name: Compare versions | |
| run: | | |
| PR_VERSION="${{ steps.pr_version.outputs.version }}" | |
| DEV_VERSION="${{ steps.dev_version.outputs.version }}" | |
| if ! npx semver "$PR_VERSION" -r ">$DEV_VERSION"; then | |
| echo "::error::Version $PR_VERSION must be greater than dev version $DEV_VERSION" | |
| echo "Run 'pnpm version:bump' to update the version" | |
| exit 1 | |
| fi | |
| echo "Version valid: $PR_VERSION > $DEV_VERSION" | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm lint | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - run: pnpm install --frozen-lockfile | |
| - name: Build | |
| env: | |
| NEXT_PUBLIC_FRONTEND_URL: https://jobstash.xyz | |
| NEXT_PUBLIC_MW_URL: https://middleware.jobstash.xyz | |
| NEXT_PUBLIC_PRIVY_APP_ID: clyr78r8l05a16wqnojin5hbz | |
| NEXT_PUBLIC_ALLOW_INDEXING: false | |
| NEXT_PUBLIC_GA_MEASUREMENT_ID: G-PQSHG9DB44 | |
| SESSION_SECRET: ci-build-dummy-secret-not-for-prod! | |
| PRIVY_APP_SECRET: ci-build-dummy-secret | |
| R2_ENDPOINT: https://placeholder.test | |
| R2_ACCESS_KEY_ID: ci-placeholder | |
| R2_SECRET_ACCESS_KEY: ci-placeholder | |
| R2_BUCKET_NAME: ci-placeholder | |
| OPENAI_API_KEY: ci-placeholder | |
| UPSTASH_REDIS_REST_URL: https://placeholder.test | |
| UPSTASH_REDIS_REST_TOKEN: ci-placeholder | |
| run: pnpm build | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm test:run |