ci: correct paths #78
Workflow file for this run
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: Push Events | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
paths: | |
- "src/**" | |
- "!src/functions/**" | |
- ".github/workflows/push.yml" | |
concurrency: | |
group: "${{ github.head_ref || github.ref }}" | |
cancel-in-progress: true | |
jobs: | |
deploy-dev: | |
name: Deploy to dev | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
environment: | |
name: dev | |
steps: | |
- name: ⬇️ Set up code | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- id: auth | |
name: 🗝️ Authenticate to Google Cloud | |
uses: google-github-actions/auth@v1 | |
with: | |
create_credentials_file: true | |
token_format: access_token | |
workload_identity_provider: ${{ secrets.IDENTITY_PROVIDER }} | |
service_account: ${{ secrets.SERVICE_ACCOUNT_EMAIL }} | |
- name: 🐳 Set up Docker Buildx | |
id: builder | |
uses: docker/setup-buildx-action@v3 | |
- name: 🗝️ Authenticate Docker to Google CLoud | |
uses: docker/login-action@v2 | |
with: | |
registry: gcr.io | |
username: oauth2accesstoken | |
password: ${{ steps.auth.outputs.access_token }} | |
- name: 📦 Build and push image | |
uses: docker/build-push-action@v5 | |
with: | |
file: ./src/api/Api.Dockerfile | |
provenance: false | |
builder: ${{ steps.builder.outputs.name }} | |
build-args: VITE_API_KEY=${{ secrets.AGRC_API_KEY }} | |
tags: gcr.io/${{ secrets.PROJECT_ID }}/api | |
context: . | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: 🚀 Deploy to Cloud Run | |
id: deploy | |
uses: google-github-actions/deploy-cloudrun@v1 | |
with: | |
service: uic-inventory-api | |
image: gcr.io/${{ secrets.PROJECT_ID }}/api | |
region: us-central1 | |
flags: | | |
--service-account=cloud-run-sa@${{ secrets.PROJECT_ID }}.iam.gserviceaccount.com | |
--set-cloudsql-instances=${{ secrets.CLOUD_SQL }} | |
--vpc-connector=${{ secrets.VPC }} | |
--vpc-egress=private-ranges-only | |
--max-instances=5 | |
--concurrency=250 | |
--cpu=1 | |
--memory=512Mi | |
--timeout=5m | |
env_vars: > | |
ASPNETCORE_URLS=http://+:8080, | |
ASPNETCORE_ENVIRONMENT=Production, | |
UPLOAD_BUCKET=${{ secrets.PROJECT_ID }}-unscanned, | |
STORAGE_BUCKET=${{ secrets.PROJECT_ID }}-documents | |
secrets: | | |
/secrets/dotnet/appsettings.Production.json=dotnet-appsettings:latest |