Remove kickoff banner (#509) #125
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 Staging and Production | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
lint: | |
name: Lint React App | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14 | |
- name: Cache npm dependencies | |
uses: actions/cache@v2 | |
with: | |
key: npm-${{ hashFiles('package-lock.json') }} | |
path: ~/.npm | |
restore-keys: | | |
npm- | |
- name: Install dependencies | |
run: npm ci --ignore-scripts --no-audit --no-progress | |
- name: Lint | |
run: npm run lint | |
lint-functions: | |
name: Lint Cloud Functions | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./functions | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14 | |
- name: Cache npm dependencies | |
uses: actions/cache@v2 | |
with: | |
key: npm-${{ hashFiles('package-lock.json') }} | |
path: ~/.npm | |
restore-keys: | | |
npm- | |
- name: Install dependencies | |
run: npm ci --ignore-scripts --no-audit --no-progress | |
- name: Lint | |
run: npm run lint | |
build-staging: | |
name: Build React App (Staging) | |
needs: [lint] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14 | |
- name: Cache npm dependencies | |
uses: actions/cache@v2 | |
with: | |
key: npm-${{ hashFiles('package-lock.json') }} | |
path: ~/.npm | |
restore-keys: | | |
npm- | |
- name: Install dependencies | |
run: npm ci --ignore-scripts --no-audit --no-progress | |
- name: Build | |
run: npm run build | |
env: | |
REACT_APP_ANALYTICS: 'true' | |
REACT_APP_SENTRY_RELEASE: ${{ github.sha }} | |
- name: Share artifact inside workflow | |
uses: actions/upload-artifact@v2 | |
with: | |
name: create-react-app-build-staging | |
path: build | |
build: | |
name: Build React App (Production) | |
needs: [lint] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14 | |
- name: Cache npm dependencies | |
uses: actions/cache@v2 | |
with: | |
key: npm-${{ hashFiles('package-lock.json') }} | |
path: ~/.npm | |
restore-keys: | | |
npm- | |
- name: Install dependencies | |
run: npm ci --ignore-scripts --no-audit --no-progress | |
- name: Build | |
run: npm run build | |
env: | |
REACT_APP_ENV: production | |
REACT_APP_FIREBASE_API_KEY: ${{ secrets.REACT_APP_FIREBASE_API_KEY }} | |
REACT_APP_FIREBASE_AUTH_DOMAIN: ${{ secrets.REACT_APP_FIREBASE_AUTH_DOMAIN }} | |
REACT_APP_FIREBASE_PROJECT_ID: ${{ secrets.REACT_APP_FIREBASE_PROJECT_ID }} | |
REACT_APP_FIREBASE_STORAGE_BUCKET: ${{ secrets.REACT_APP_FIREBASE_STORAGE_BUCKET }} | |
REACT_APP_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.REACT_APP_FIREBASE_MESSAGING_SENDER_ID }} | |
REACT_APP_FIREBASE_APP_ID: ${{ secrets.REACT_APP_FIREBASE_APP_ID }} | |
REACT_APP_FIREBASE_MEASUREMENT_ID: ${{ secrets.REACT_APP_FIREBASE_MEASUREMENT_ID }} | |
REACT_APP_SENTRY_RELEASE: ${{ github.sha }} | |
- name: Share artifact inside workflow | |
uses: actions/upload-artifact@v2 | |
with: | |
name: create-react-app-prod | |
path: build | |
build-functions: | |
name: Build Cloud Functions | |
needs: [lint-functions] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./functions | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14 | |
- name: Cache npm dependencies | |
uses: actions/cache@v2 | |
with: | |
key: npm-${{ hashFiles('package-lock.json') }} | |
path: ~/.npm | |
restore-keys: | | |
npm- | |
- name: Install dependencies | |
run: npm ci --ignore-scripts --no-audit --no-progress | |
- name: Build | |
run: npm run build | |
- name: Share artifact inside workflow | |
uses: actions/upload-artifact@v2 | |
with: | |
name: functions-build | |
path: functions/lib | |
deploy-staging: | |
name: Deploy to Firebase (Staging) | |
runs-on: ubuntu-latest | |
needs: [lint, lint-functions, build-staging, build-functions] | |
environment: staging | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14 | |
- name: Get React build artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: create-react-app-build-staging | |
path: build | |
- name: Get Functions build artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: functions-build | |
path: functions/lib | |
- name: Cache npm dependencies | |
uses: actions/cache@v2 | |
with: | |
key: npm-${{ hashFiles('functions/package-lock.json') }} | |
path: ~/.npm | |
restore-keys: | | |
npm- | |
- name: Install Cloud Function dependencies | |
working-directory: './functions' | |
run: npm ci --ignore-scripts --no-audit --no-progress | |
- name: Deploy to Firebase | |
uses: w9jds/firebase-action@master | |
with: | |
args: deploy --only hosting,functions --project default | |
env: | |
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} | |
- name: Create Sentry release | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
with: | |
environment: staging | |
sourcemaps: './build/static/js/' | |
url_prefix: '~/static/js' | |
deploy: | |
name: Deploy to Firebase (Production) | |
runs-on: ubuntu-latest | |
needs: [build, deploy-staging] | |
environment: production | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14 | |
- name: Get React build artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: create-react-app-prod | |
path: build | |
- name: Get Functions build artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: functions-build | |
path: functions/lib | |
- name: Cache npm dependencies | |
uses: actions/cache@v2 | |
with: | |
key: npm-${{ hashFiles('functions/package-lock.json') }} | |
path: ~/.npm | |
restore-keys: | | |
npm- | |
- name: Install Cloud Function dependencies | |
working-directory: './functions' | |
run: npm ci --ignore-scripts --no-audit --no-progress | |
- name: Deploy to Firebase | |
uses: w9jds/firebase-action@master | |
with: | |
args: deploy --only hosting,functions --project production | |
env: | |
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} | |
- name: Create Sentry release | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
with: | |
environment: production | |
sourcemaps: './build/static/js/' | |
url_prefix: '~/static/js' |