Repository navigation
fix: fixed login refresh issue for frontend #15
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-CD Pipeline | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| name: Run tests | |
| runs-on: ubuntu-latest | |
| services: | |
| redis: | |
| image: redis:latest | |
| ports: | |
| - 6379:6379 | |
| options: --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| postgres: | |
| image: postgres:16-alpine | |
| ports: | |
| - 5432:5432 | |
| env: | |
| POSTGRES_USER: test | |
| POSTGRES_PASSWORD: test | |
| POSTGRES_DB: testdb | |
| options: >- | |
| --health-cmd "pg_isready -U test" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Generate Prisma Client | |
| run: npx prisma generate | |
| env: | |
| DATABASE_URL: "postgresql://fake:fake@localhost:5432/fake" | |
| - name: Run Prisma migrations | |
| run: npx prisma migrate deploy | |
| env: | |
| DATABASE_URL: "postgresql://test:test@localhost:5432/testdb" | |
| - name: Run tests | |
| run: npm test | |
| env: | |
| NODE_ENV: test | |
| BASE_URL: "http://localhost:3000" | |
| DATABASE_URL: "postgresql://test:test@localhost:5432/testdb" | |
| REDIS_URL: "redis://localhost:6379" | |
| EMAIL_HOST: "smtp.gmail.com" | |
| EMAIL_PORT: "587" | |
| EMAIL_USER: ${{ secrets.EMAIL_USER }} | |
| EMAIL_PASS: ${{ secrets.EMAIL_PASS }} | |
| ACCESS_SECRET: ${{ secrets.ACCESS_SECRET }} | |
| REFRESH_SECRET: ${{ secrets.REFRESH_SECRET }} | |
| ACCESS_EXPIRES_IN: "15m" | |
| REFRESH_EXPIRES_IN: "7d" | |
| SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | |
| SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }} | |
| FRONTEND_URL: "http://localhost:3000" | |
| build-and-push: | |
| name: Build and push to Docker Hub | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| tags: ${{ secrets.DOCKER_USERNAME }}/notifierapi:latest | |
| - name: Deployed to Docker Hub | |
| run: echo "Deployed to Docker Hub" |