Deploy bff-search #9
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: Deploy bff-search | |
on: | |
workflow_dispatch: | |
inputs: | |
deployToDev: | |
type: boolean | |
description: dev | |
default: false | |
deployToStaging: | |
type: boolean | |
description: staging | |
default: true | |
deployToBeta: | |
type: boolean | |
description: beta | |
default: false | |
deployToProd: | |
type: boolean | |
description: prod | |
default: false | |
deployToInt: | |
type: boolean | |
description: int | |
default: false | |
jobs: | |
calculate-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{steps.calculate-deploy-matrix.outputs.result}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Calculate parameters | |
uses: actions/github-script@v7 | |
id: calculate-deploy-matrix | |
with: | |
script: | | |
const inputs = ${{toJSON(inputs)}} | |
const environment = Object.entries({ | |
dev: inputs.deployToDev, | |
int: inputs.deployToInt, | |
staging: inputs.deployToStaging, | |
beta: inputs.deployToBeta, | |
prod: inputs.deployToProd, | |
}) | |
.map(([env, include]) => (include ? env : undefined)) | |
.filter(Boolean) | |
return { environment } | |
deploy-bff-search: | |
name: Deploy bff-search to ${{matrix.environment}} | |
runs-on: ubuntu-latest | |
needs: calculate-matrix | |
environment: ec-${{matrix.environment}} | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.calculate-matrix.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build and test | |
uses: ./.github/actions/build-and-test | |
- name: Set gcloud Auth | |
run: echo $FIREBASE_DEPLOY_CREDENTIALS | gcloud auth activate-service-account --key-file=- | |
env: | |
FIREBASE_DEPLOY_CREDENTIALS: ${{secrets.FIREBASE_DEPLOY_CREDENTIALS}} | |
- name: Set gcloud project | |
run: gcloud --quiet config set project ${{vars.GCP_PROJECT}} | |
- name: Upload type defs to GCP bucket | |
run: gsutil cp typeDeclarations.tar.gz "gs://${{vars.GCP_PROJECT}}-search-types/" | |
- name: Deploy to Google App Engine | |
run: gcloud app deploy ./app-${{matrix.environment}}.yaml cron.yaml --quiet --verbosity=info | |
- name: Send Slack message | |
run: ./scripts/slack.sh ./app-${{matrix.environment}} | |
env: | |
ENTUR_DEPLOY_SLACK_WEBHOOK: ${{secrets.ENTUR_DEPLOY_SLACK_WEBHOOK}} |