feat(api): api update #178
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 Docker-MCP to GCloud | |
| on: | |
| push: | |
| branches: | |
| - next | |
| - main | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| name: Build Docker-MCP (${{ matrix.environment }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # <branch> -> <github environment> | |
| # next -> develop | |
| # main -> staging, prod | |
| environment: ${{ github.ref_name == 'next' && fromJson('["develop"]') || fromJson('["staging","prod"]') }} | |
| environment: | |
| name: ${{ matrix.environment }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Authenticate to Google Cloud | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| credentials_json: '${{ secrets.GCP_SA_KEY }}' | |
| - name: Configure Docker for Artifact Registry | |
| run: gcloud auth configure-docker ${{ vars.IMAGE_REGION }}-docker.pkg.dev --quiet | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./packages/mcp-server/Dockerfile | |
| push: true | |
| platforms: linux/amd64 | |
| tags: ${{ vars.IMAGE_REGION }}-docker.pkg.dev/${{ vars.IMAGE_PROJECT_ID }}/droidrun/${{ vars.IMAGE_NAME }}:${{ matrix.environment == 'develop' && 'dev' || matrix.environment }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| deploy: | |
| name: Deploy Cloud (${{ matrix.environment }}) | |
| runs-on: ubuntu-latest | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # <branch> -> <github environment> | |
| # next -> develop | |
| # main -> staging, prod | |
| environment: ${{ github.ref_name == 'next' && fromJson('["develop"]') || fromJson('["staging","prod"]') }} | |
| environment: | |
| name: ${{ matrix.environment }} | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| steps: | |
| - name: Authenticate to Google Cloud | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| credentials_json: '${{ secrets.GCP_SA_KEY }}' | |
| - name: Get GKE credentials | |
| uses: google-github-actions/get-gke-credentials@v2 | |
| with: | |
| cluster_name: ${{ vars.CLUSTER }} | |
| location: ${{ vars.REGION }} | |
| project_id: ${{ vars.PROJECT_ID }} | |
| - name: Restart Kubernetes deployment | |
| run: kubectl rollout restart deployment/${{ vars.K8S_DEPLOYMENT_NAME }} -n ${{ vars.K8S_NAMESPACE }} |