Skip to content

feat: add http request and response #57

feat: add http request and response

feat: add http request and response #57

name: Build and Deploy to Cloud Run
on:
push:
branches: ["master"]
env:
PROJECT_ID: green-plasma-423322-n1
GAR_LOCATION: us-east1
SERVICE: pia-labs-ecommerce-api
REGION: us-east1
jobs:
deploy:
# Add 'id-token' with the intended permissions for workload identity federation
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Google Auth
id: auth
uses: 'google-github-actions/auth@v0'
with:
token_format: 'access_token'
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' # e.g. - projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' # e.g. - my-service-account@my-project.iam.gserviceaccount.com
# Authenticate Docker to Google Cloud Artifact Registry
- name: Docker Auth
id: docker-auth
uses: 'docker/login-action@v1'
with:
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
registry: '${{ env.GAR_LOCATION }}-docker.pkg.dev'
- name: Build and Push Container
run: |-
docker build -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.SERVICE }}:${{ github.sha }}" ./
docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.SERVICE }}:${{ github.sha }}"
# END - Docker auth and build
- name: Deploy to Cloud Run
id: deploy
uses: google-github-actions/deploy-cloudrun@v0
with:
service: ${{ env.SERVICE }}
region: ${{ env.REGION }}
# NOTE: If using a pre-built image, update the image name here
image: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.SERVICE }}:${{ github.sha }}
secrets: |-
JWT_PUBLIC_KEY=JWT_PUBLIC_KEY:latest
JWT_PRIVATE_KEY=JWT_PRIVATE_KEY:latest
MONGO_URI=MONGO_URI:latest
GOOGLE_APPLICATION_CREDENTIALS_BASE_64=GOOGLE_APPLICATION_CREDENTIALS:latest
GOOGLE_STORAGE_BUCKET=GOOGLE_STORAGE_BUCKET:latest
GOOGLE_GMAIL_USER=GOOGLE_GMAIL_USER:latest
GOOGLE_GMAIL_PASSWORD=GOOGLE_GMAIL_PASSWORD:latest
GOOGLE_PUB_SUB_CHECKOUT_TOPIC=GOOGLE_PUB_SUB_CHECKOUT_TOPIC:latest
TRAIN_MODEL_CRON=TRAIN_MODEL_CRON:latest
env_vars: |-
APP_NAME=PiaLabs Ecommerce
APP_EMAIL=guilhermeteixeiraais@gmail.com
ACCOUNT_CONFIRMATION_URL=https://ecommerceclientspialabs.azurewebsites.net/finish-signup
FINISH_SIGNUP_INVITE_URL=https://ecommerceclientspialabs.azurewebsites.net/finish-signup
# If required, use the Cloud Run url output in later steps
- name: Show Output
run: echo ${{ steps.deploy.outputs.url }}