Skip to content

Commit

Permalink
Point to new firebase projects
Browse files Browse the repository at this point in the history
  • Loading branch information
eltoder committed Nov 17, 2024
1 parent 0c586c5 commit e26b41f
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 63 deletions.
4 changes: 2 additions & 2 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"projects": {
"default": "setwithfriends",
"staging": "setwithfriends-dev"
"prod": "setwithforks",
"preview": "setwithforks-dev"
}
}
30 changes: 6 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,10 @@ jobs:

preview:
name: Deploy Preview
runs-on: ubuntu-latest
needs: [format, lint_test, functions]
if:
success() && github.event_name == 'push' && github.repository_owner ==
'ekzhang'
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: "20"

- run: npm ci

- run: npm ci
working-directory: functions

- run: npm run build:preview

- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy -P staging --only database,functions,hosting
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
if: github.event_name == 'push' && github.repository_owner == 'eltoder'
uses: ./.github/workflows/deploy.yml
with:
env: preview
secrets:
firebase-token: ${{ secrets.FIREBASE_DEV_TOKEN }}
32 changes: 15 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
name: Deploy

on:
release:
types: [published]
workflow_call:
inputs:
env:
required: true
type: string
secrets:
firebase-token:
required: true

jobs:
deploy:
name: Production
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: ${{ github.ref_type == 'tag' && 1 || 0 }}

- uses: actions/setup-node@v4
with:
Expand All @@ -22,22 +28,14 @@ jobs:
working-directory: functions

- name: Set env
run: echo "REACT_APP_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
run: |
echo "REACT_APP_VERSION=$(git describe --tags HEAD|sed s/^v//)" >> $GITHUB_ENV
- run: npm run build
- run: npm run build:${{ inputs.env }}

- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy -P default --only database,functions
args: deploy -P ${{ inputs.env }} --only database,functions,hosting
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

- name: Deploy to Netlify
uses: South-Paw/action-netlify-deploy@v1.2.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}
build-dir: "./build"
config-path: "./netlify.toml"
FIREBASE_TOKEN: ${{ secrets.firebase-token }}
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Release

on:
release:
types: [published]

jobs:
deploy:
name: Deploy Production
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: ./.github/workflows/deploy.yml
with:
env: prod
secrets:
firebase-token: ${{ secrets.FIREBASE_PROD_TOKEN }}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "setwithfriends",
"version": "1.0.0",
"repository": "https://github.com/ekzhang/setwithfriends",
"repository": "https://github.com/eltoder/setwithfriends",
"license": "MIT",
"description": "Online, real-time set application hosted on Firebase.",
"keywords": [],
Expand Down Expand Up @@ -39,7 +39,7 @@
"dev": "node rundev.js",
"build:dev": "react-scripts build",
"build:preview": "cross-env REACT_APP_ENV=preview react-scripts build",
"build": "cross-env REACT_APP_ENV=production react-scripts build",
"build:prod": "cross-env REACT_APP_ENV=production react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"format": "prettier --write ."
Expand Down
32 changes: 14 additions & 18 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,26 @@
const config = {
development: {
firebase: {
apiKey: "AIzaSyB6jICg__HEdtZRcSoIoeUMau41jvKNwvU",
authDomain: "setwithfriends-dev.web.app",
databaseURL: "https://setwithfriends-dev.firebaseio.com",
projectId: "setwithfriends-dev",
appId: "1:369319422608:web:b9038b38a1bd598048c615",
apiKey: "AIzaSyDJbrpSFlmr2D9r9HS0UiFkw_Qk7wlY0lA",
authDomain: "setwithforks-dev.firebaseapp.com",
databaseURL: "https://setwithforks-dev-default-rtdb.firebaseio.com",
projectId: "setwithforks-dev",
appId: "1:488130851214:web:e656dc30f31e99e160b4df",
},
stripe: null, // Stripe not supported in development
},
preview: {
firebase: {
apiKey: "AIzaSyB6jICg__HEdtZRcSoIoeUMau41jvKNwvU",
authDomain: "setwithfriends-dev.web.app",
databaseURL: "https://setwithfriends-dev.firebaseio.com",
projectId: "setwithfriends-dev",
storageBucket: "setwithfriends-dev.appspot.com",
messagingSenderId: "369319422608",
appId: "1:369319422608:web:b9038b38a1bd598048c615",
measurementId: "G-GN0204W8F7",
},
stripe: {
publishableKey:
"pk_test_51I0VxyCWK9K42cLJfn9bVu57liV6yS9BP1iS6hKCMvtZ3ObTGcYDxz544z2P9CPkN1a0T3VTYbpUcBO1AUDLwTGz00KDNytNhW",
priceId: "price_1I2Wi2CWK9K42cLJMyY0yzKT",
apiKey: "AIzaSyDJbrpSFlmr2D9r9HS0UiFkw_Qk7wlY0lA",
authDomain: "setwithforks-dev.firebaseapp.com",
databaseURL: "https://setwithforks-dev-default-rtdb.firebaseio.com",
projectId: "setwithforks-dev",
storageBucket: "setwithforks-dev.firebasestorage.app",
messagingSenderId: "488130851214",
appId: "1:488130851214:web:e656dc30f31e99e160b4df",
measurementId: "G-LQR3228JDG",
},
stripe: null, // No Stripe yet
},
production: {
firebase: {
Expand Down

0 comments on commit e26b41f

Please sign in to comment.