Skip to content

feat: Report Composer UI and Landing Page Feature Showcase #20

feat: Report Composer UI and Landing Page Feature Showcase

feat: Report Composer UI and Landing Page Feature Showcase #20

Workflow file for this run

name: Deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [labeled, opened, synchronize, reopened]
env:
GCP_PROJECT_ID: dill-vc
GCP_REGION: us-central1
SERVICE_NAME: dill
ARTIFACT_REGISTRY: dill-vc/dill
WORKLOAD_IDENTITY_PROVIDER: projects/48483662515/locations/global/workloadIdentityPools/github-actions/providers/github
SERVICE_ACCOUNT: github-actions@dill-vc.iam.gserviceaccount.com
permissions:
contents: read
id-token: write
pull-requests: write
jobs:
# Deploy to staging on PR
deploy-staging:
name: Deploy to Staging
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
environment:
name: staging
url: ${{ steps.deploy.outputs.url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ env.SERVICE_ACCOUNT }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ env.GCP_PROJECT_ID }}
- name: Configure Docker
run: gcloud auth configure-docker ${{ env.GCP_REGION }}-docker.pkg.dev
- name: Build and Push Docker Image
run: |
IMAGE_URI="${{ env.GCP_REGION }}-docker.pkg.dev/${{ env.ARTIFACT_REGISTRY }}/app:staging-${{ github.sha }}"
docker build -t ${IMAGE_URI} .
docker push ${IMAGE_URI}
echo "IMAGE_URI=${IMAGE_URI}" >> ${GITHUB_ENV}
- name: Deploy to Cloud Run (Staging)
id: deploy
run: |
URL=$(gcloud run deploy ${{ env.SERVICE_NAME }}-staging \
--image ${{ env.IMAGE_URI }} \
--region ${{ env.GCP_REGION }} \
--platform managed \
--allow-unauthenticated \
--set-env-vars RAILS_ENV=production,RAILS_LOG_TO_STDOUT=true \
--set-secrets SECRET_KEY_BASE=SECRET_KEY_BASE:latest,DATABASE_URL=DATABASE_URL:latest \
--format "value(uri)")
echo "url=${URL}" >> ${GITHUB_OUTPUT}
- name: Comment PR with Staging URL
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `🚀 Staging deployed: ${{ steps.deploy.outputs.url }}`
})
# Deploy to production on main push
deploy-production:
name: Deploy to Production
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
environment:
name: production
url: https://dill.vc
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ env.SERVICE_ACCOUNT }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ env.GCP_PROJECT_ID }}
- name: Configure Docker
run: gcloud auth configure-docker ${{ env.GCP_REGION }}-docker.pkg.dev
- name: Build and Push Docker Image
run: |
IMAGE_URI="${{ env.GCP_REGION }}-docker.pkg.dev/${{ env.ARTIFACT_REGISTRY }}/app:prod-${{ github.sha }}"
docker build -t ${IMAGE_URI} .
docker push ${IMAGE_URI}
echo "IMAGE_URI=${IMAGE_URI}" >> ${GITHUB_ENV}
- name: Deploy to Cloud Run (Production)
run: |
gcloud run deploy ${{ env.SERVICE_NAME }} \
--image ${{ env.IMAGE_URI }} \
--region ${{ env.GCP_REGION }} \
--platform managed \
--allow-unauthenticated \
--set-env-vars RAILS_ENV=production,RAILS_LOG_TO_STDOUT=true \
--set-secrets SECRET_KEY_BASE=SECRET_KEY_BASE:latest,DATABASE_URL=DATABASE_URL:latest