Skip to content

1.0.64

1.0.64 #202

name: Action | Deploy to Production
on:
release:
types: [published]
jobs:
deploy_api:
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_SOONAVERSE }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
- name: 'Use gcloud CLI'
run: 'gcloud info'
- name: Install dependencies
run: npm install
- name: Build Instance
run: npm run build:api
- name: Deploy Instance
run: |
cd packages/api
npm run deploy:prod
deploy_functions:
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Set env vars
working-directory: packages/functions
run: echo "$FUNCTIONS_ENV_VARS" >> .env
env:
FUNCTIONS_ENV_VARS: ${{ secrets.FUNCTIONS_ENV_VARS_PROD }}
- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only functions,firestore:indexes -P soonaverse -f
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
deploy_to_npm:
runs-on: ubuntu-latest
environment: production
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- name: Init
run: |
npm version ${{ github.event.release.tag_name }} --workspace packages/interfaces
npm version ${{ github.event.release.tag_name }} --workspace packages/lib
npm run build:lib
- name: Deploy to npm
run: |
npm publish --workspace packages/interfaces
npm publish --workspace packages/lib
roll-firestore:
runs-on: ubuntu-latest
environment: production
timeout-minutes: 360
needs: [deploy_functions]
defaults:
run:
working-directory: packages/database
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '10'
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: |
npm i -g ts-node
cd ../../ && npm run build:database
- name: Set env vars
run: echo "$FUNCTIONS_ENV_VARS" >> .env
env:
FUNCTIONS_ENV_VARS: ${{ secrets.FUNCTIONS_ENV_VARS_PROD }}
- name: Create serviceAccountKey.json
run: echo "$SERVICE_ACCOUNT" >> scripts/serviceAccountKey.json
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_SOONAVERSE }}
- name: Roll firestore
run: cd scripts && ts-node db.upgrade.ts