Seeding database only if production and if is empty #40
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: CI & CD | ||
on: | ||
# Trigger the workflow on pushes to the main branch, including PR merges: | ||
push: | ||
branches: | ||
- main | ||
# Generate a GitHub token that can be exchanged with Google Cloud - see | ||
# https://github.com/google-github-actions/auth/tree/v0.6.0#setting-up-workload-identity-federation | ||
permissions: | ||
contents: read | ||
id-token: write | ||
deployments: write | ||
jobs: | ||
test-and-build: | ||
name: Integration | ||
uses: ./.github/workflows/test-and-build.yml | ||
secrets: inherit | ||
deploy-to-staging: | ||
name: Staging | ||
uses: ./.github/workflows/deploy-to-cloud-run.yml | ||
needs: | ||
- test-and-build | ||
with: | ||
environment: staging | ||
deploy-name: staging | ||
cloud-sql-instance: sepomex-365521:us-central1:sepomex | ||
cloud-sql-username-secret: database-username:latest | ||
cloud-sql-password-secret: database-password:latest | ||
cloud-run-service-suffix: ${{ needs.test-and-build.outputs.git-commit-short-sha }} | ||
cloud-run-container-image: us-central1-docker.pkg.dev/sepomex-365521/icalialabs-sepomex/sepomex@${{ needs.test-and-build.outputs.container-image-digest }} | ||
deploy-to-staging: | ||
name: Staging | ||
uses: ./.github/workflows/deploy-to-cloud-run.yml | ||
needs: | ||
- test-and-build | ||
with: | ||
environment: production | ||
deploy-name: production | ||
cloud-sql-instance: sepomex-365521:us-central1:sepomex | ||
cloud-sql-username-secret: database-username:latest | ||
cloud-sql-password-secret: database-password:latest | ||
cloud-run-service-suffix: ${{ needs.test-and-build.outputs.git-commit-short-sha }} | ||
cloud-run-container-image: us-central1-docker.pkg.dev/sepomex-365521/icalialabs-sepomex/sepomex@${{ needs.test-and-build.outputs.container-image-digest }} | ||
# cloud-run-minimum-instances: 1 # Uncomment once we want it to be always on |