Forgot --project #79
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 Backend | |
on: | |
push: | |
branches: | |
- burgess/pipeline | |
# paths: | |
# - "backend/**" | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./backend | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
cache: "npm" | |
- run: npm ci | |
- run: npm run build | |
- name: Deploy to Cloud Run | |
run: | | |
echo $GOOGLE_APPLICATION_CREDENTIALS > ~/google-credentials.json | |
gcloud auth activate-service-account --key-file ~/google-credentials.json | |
echo $SVC_EMAIL_SERVICE_ACCOUNT_GETBASELINEAPP > getbaselineapp-svc-email.json | |
npm run deploy -- --ingress=all | |
env: | |
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_GETBASELINEAPP }} | |
SVC_EMAIL_SERVICE_ACCOUNT_GETBASELINEAPP: ${{ secrets.SVC_EMAIL_SERVICE_ACCOUNT_GETBASELINEAPP }} | |
test: | |
runs-on: ubuntu-latest | |
needs: deploy | |
defaults: | |
run: | |
working-directory: . | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
cache: "npm" | |
- run: npm ci | |
- name: Build Tests | |
run: | | |
npm install -g ionic | |
npm run build | |
ionic cap sync | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
REACT_APP_BASE_URL: ${{ secrets.REACT_APP_BASE_URL }} | |
- name: Integration Tests | |
run: | | |
PORT=8100 npx react-scripts -r @cypress/instrument-cra start & | |
sleep 60 | |
npm run test:e2e | |
env: | |
HAPPO_API_KEY: ${{ secrets.HAPPO_API_KEY }} | |
HAPPO_API_SECRET: ${{ secrets.HAPPO_API_SECRET }} | |
HAPPO_NONCE: ${{ github.run_id }} | |
REACT_APP_BASE_URL: ${{ secrets.REACT_APP_BASE_URL }} | |
- name: Upload Test Video | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-video | |
path: cypress/videos | |
- name: Upload Test Screenshots | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-screenshots | |
path: cypress/screenshots | |
increase-traffic: | |
runs-on: ubuntu-latest | |
needs: test | |
defaults: | |
run: | |
working-directory: . | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Increase Traffic | |
run: | | |
echo $GOOGLE_APPLICATION_CREDENTIALS > ~/google-credentials.json | |
gcloud auth activate-service-account --key-file ~/google-credentials.json | |
gcloud run services update-traffic baseline-backend --project getbaselineapp --to-latest | |
gcloud run services update baseline-backend --project getbaselineapp --platform managed --ingress internal-and-cloud-load-balancing | |
env: | |
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_GETBASELINEAPP }} | |
SVC_EMAIL_SERVICE_ACCOUNT_GETBASELINEAPP: ${{ secrets.SVC_EMAIL_SERVICE_ACCOUNT_GETBASELINEAPP }} | |