Merge pull request #52 from precious112/dev #22
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: Deploy to GKE | |
| on: | |
| push: | |
| branches: [ main ] | |
| env: | |
| PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} | |
| GKE_CLUSTER: ${{ secrets.GKE_CLUSTER }} | |
| GKE_ZONE: ${{ secrets.GKE_ZONE }} | |
| GCR_HOSTNAME: gcr.io | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: 'auth' | |
| uses: 'google-github-actions/auth@v2' | |
| with: | |
| credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | |
| - name: Set up Cloud SDK | |
| uses: google-github-actions/setup-gcloud@v2 | |
| - name: Get GKE Credentials | |
| uses: google-github-actions/get-gke-credentials@v2 | |
| with: | |
| cluster_name: ${{ env.GKE_CLUSTER }} | |
| location: ${{ env.GKE_ZONE }} | |
| - name: Login to GCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: gcr.io | |
| username: _json_key | |
| password: ${{ secrets.GCP_CREDENTIALS }} | |
| - name: Build and Push API | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./api | |
| push: true | |
| tags: gcr.io/${{ env.PROJECT_ID }}/prism-api:${{ github.sha }} | |
| - name: Build and Push Client | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./client | |
| push: true | |
| tags: gcr.io/${{ env.PROJECT_ID }}/prism-client:${{ github.sha }} | |
| build-args: | | |
| NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }} | |
| NEXT_PUBLIC_WS_URL=${{ secrets.NEXT_PUBLIC_WS_URL }} | |
| NEXT_PUBLIC_OFFLINE_MODE=false | |
| - name: Build and Push Worker | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./core | |
| push: true | |
| tags: gcr.io/${{ env.PROJECT_ID }}/prism-worker:${{ github.sha }} | |
| - name: Build and Push Websocket | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./websocket | |
| push: true | |
| tags: gcr.io/${{ env.PROJECT_ID }}/prism-websocket:${{ github.sha }} | |
| - name: Prepare Manifests | |
| env: | |
| GOOGLE_PROJECT_ID: ${{ env.PROJECT_ID }} | |
| GCR_HOSTNAME: ${{ env.GCR_HOSTNAME }} | |
| GITHUB_SHA: ${{ github.sha }} | |
| REDIS_URL: "redis://redis:6379" | |
| POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | |
| POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | |
| POSTGRES_DB: ${{ secrets.POSTGRES_DB }} | |
| DATABASE_URL: "postgresql://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@postgres:5432/${{ secrets.POSTGRES_DB }}?schema=public" | |
| ACCESS_TOKEN_SECRET: ${{ secrets.ACCESS_TOKEN_SECRET }} | |
| REFRESH_TOKEN_SECRET: ${{ secrets.REFRESH_TOKEN_SECRET }} | |
| RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }} | |
| WORKER_SECRET: ${{ secrets.WORKER_SECRET }} | |
| GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} | |
| GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} | |
| GITHUB_CLIENT_ID: ${{ secrets.GH_CLIENT_ID }} | |
| GITHUB_CLIENT_SECRET: ${{ secrets.GH_CLIENT_SECRET }} | |
| WORKER_API_KEY: ${{ secrets.WORKER_API_KEY }} | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| SERPER_API_KEY: ${{ secrets.SERPER_API_KEY }} | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
| XAI_API_KEY: ${{ secrets.XAI_API_KEY }} | |
| CLIENT_URL: ${{ secrets.CLIENT_URL }} | |
| run: | | |
| for file in k8s/*.yaml; do | |
| envsubst < "$file" > "$file.tmp" && mv "$file.tmp" "$file" | |
| done | |
| - name: Deploy | |
| run: | | |
| kubectl apply -f k8s/ |