name: Deploy on: push: branches: ["main", "dev"] pull_request: branches: ["main", "dev"] permissions: contents: read jobs: build: name: Build runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v6 with: version: 11.5.2 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: "24" - name: Install dependencies run: | cd Backend pnpm install --frozen-lockfile cd ../UI pnpm install --frozen-lockfile - name: Generate Prisma client working-directory: Backend run: pnpm generate env: DATABASE_URL: postgresql://x:x@localhost/x - name: Build backend working-directory: Backend run: pnpm run build - name: Build UI working-directory: UI run: pnpm run build test-and-lint: name: Test & Lint needs: build runs-on: ubuntu-latest services: postgres: image: postgres:16-alpine env: POSTGRES_USER: patchpass POSTGRES_PASSWORD: patchpass POSTGRES_DB: patchpass ports: - 5432:5432 options: >- --health-cmd "pg_isready -U patchpass -d patchpass" --health-interval 10s --health-timeout 5s --health-retries 5 env: DATABASE_URL: postgresql://patchpass:patchpass@postgres:5432/patchpass TEST_DATABASE_URL: postgresql://patchpass:patchpass@postgres:5432/patchpass steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v6 with: version: 11.5.2 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: "24" - name: Install dependencies run: | cd Backend pnpm install --frozen-lockfile cd ../UI pnpm install --frozen-lockfile - name: Generate Prisma client working-directory: Backend run: pnpm generate - name: Backend lint working-directory: Backend run: pnpm lint - name: UI lint working-directory: UI run: pnpm lint - name: Backend tests working-directory: Backend run: pnpm exec vitest run --passWithNoTests push-image: name: Build and Push Docker Image needs: [build, test-and-lint] runs-on: ubuntu-latest if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup Buildx uses: docker/setup-buildx-action@v3 - name: Generate image metadata id: meta uses: docker/metadata-action@v5 with: images: registry.reversed.dev/patchpass/core tags: | type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} type=raw,value=prod,enable=${{ github.ref == 'refs/heads/main' }} type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }} type=sha,format=long labels: | org.opencontainers.image.title=PatchPass org.opencontainers.image.description=A human approval layer for AI agents org.opencontainers.image.vendor=space - name: Log in to Harbor uses: docker/login-action@v3 with: registry: registry.reversed.dev username: ${{ secrets.HARBOR_USERNAME }} password: ${{ secrets.HARBOR_PASSWORD }} - name: Build and push image uses: docker/build-push-action@v6 with: context: . push: true provenance: false sbom: false tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}