docs: update readme #6
This file contains 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 Ponder | |
on: | |
push: | |
paths: | |
- "apps/ponder/**" | |
workflow_dispatch: | |
jobs: | |
deploy-ponder: | |
name: Deploy Ponder Backend | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' # Deploy only on main branch | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: 'pnpm' | |
- name: Install pnpm | |
run: corepack enable && pnpm install -g pnpm | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build project | |
run: pnpm turbo run build --filter=ponder... | |
- name: Install Supabase CLI | |
run: npm install -g supabase | |
- name: Authenticate Supabase CLI | |
run: supabase link --project-id ${{ secrets.SUPABASE_PROJECT_ID }} --service-role-key ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }} | |
- name: Get Supabase Branch Connection URL | |
run: | | |
BRANCH_NAME=$(echo $GITHUB_REF_NAME | sed 's/\//_/g') | |
CONNECTION_URL=$(supabase db branches list --json | jq -r --arg BRANCH "$BRANCH_NAME" '.[] | select(.name == $BRANCH) | .connectionString') | |
echo "SUPABASE_CONNECTION_URL=$CONNECTION_URL" >> $GITHUB_ENV | |
- name: Authenticate with Google Cloud | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.GCLOUD_CREDENTIALS }} | |
- name: Configure Docker for Google Cloud | |
run: gcloud auth configure-docker | |
- name: Build and push Docker image | |
run: | | |
export IMAGE_NAME=gcr.io/${{ secrets.GCLOUD_PROJECT_ID }}/ponder | |
docker build -t $IMAGE_NAME ./apps/ponder | |
docker push $IMAGE_NAME | |
- name: Deploy to Cloud Run with Supabase Connection String | |
run: | | |
gcloud run deploy ponder-service \ | |
--image gcr.io/${{ secrets.GCLOUD_PROJECT_ID }}/ponder \ | |
--region us-central1 \ | |
--platform managed \ | |
--allow-unauthenticated \ | |
--memory=512Mi \ | |
--cpu=1 \ | |
--timeout=30s \ | |
--set-env-vars DATABASE_URL=${{ env.SUPABASE_CONNECTION_URL }} |