Skip to content

log user

log user #56

Workflow file for this run

name: Deploy
on:
push:
branches: [develop, main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
set-environment:
name: πŸ”¨ Set Environment
runs-on: ubuntu-22.04
outputs:
github-environment: ${{ steps.set-environment.outputs.environment }}
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v3
- id: set-environment
name: πŸ“ Set Environment
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "environment=production" >> $GITHUB_OUTPUT
else
echo "environment=develop" >> $GITHUB_OUTPUT
fi
build-and-deploy-to-google:
name: πŸš€ Deploy to ${{github.ref_name}}
needs: set-environment
environment: ${{ needs.set-environment.outputs.github-environment }}
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-22.04
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v3
- id: 'auth'
name: πŸͺͺ Google Auth
uses: google-github-actions/auth@v1
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- name: πŸ”‘ Authorize Docker push
run: gcloud auth configure-docker
- name: πŸ—οΈ Build and 🐳 Push Container
run: |-
docker build -t gcr.io/${{ secrets.GCP_PROJECT }}/${{ secrets.GOOGLE_CLOUD_RUN_SERVICE }}:${{ github.sha }} .
docker push gcr.io/${{ secrets.GCP_PROJECT }}/${{ secrets.GOOGLE_CLOUD_RUN_SERVICE }}:${{ github.sha }}
- id: 'deploy'
name: πŸš€ Deploy to Cloud Run
uses: google-github-actions/deploy-cloudrun@v1
with:
service: ${{ secrets.GOOGLE_CLOUD_RUN_SERVICE }}
image: 'gcr.io/${{ secrets.GCP_PROJECT }}/${{ secrets.GOOGLE_CLOUD_RUN_SERVICE }}:${{ github.sha }}'