Skip to content

Commit

Permalink
Setup firebase hosting from local. Included code for github workflows…
Browse files Browse the repository at this point in the history
… to publish to firebase, with testing pending
  • Loading branch information
ThatNinjaGuy committed Sep 28, 2024
1 parent 0f7b8bf commit cbe8b33
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .firebase/hosting.ZGlzdA.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
_expo/static/js/web/index-d41d8cd98f00b204e9800998ecf8427e.js,1727522244062,f1b651238a58fe290baec6c5e32f3bdb1943dd2bd582f02569231f7a757c7837
staffs.html,1727522244018,a3dab4e1df701f2a5f85c8a627149b261b4337f5f1fefb39bc605de92180f1ea
tables.html,1727522244018,a3dab4e1df701f2a5f85c8a627149b261b4337f5f1fefb39bc605de92180f1ea
profile.html,1727522244017,a3dab4e1df701f2a5f85c8a627149b261b4337f5f1fefb39bc605de92180f1ea
orders.html,1727522244018,a3dab4e1df701f2a5f85c8a627149b261b4337f5f1fefb39bc605de92180f1ea
menu.html,1727522244017,a3dab4e1df701f2a5f85c8a627149b261b4337f5f1fefb39bc605de92180f1ea
inventory.html,1727522244016,a3dab4e1df701f2a5f85c8a627149b261b4337f5f1fefb39bc605de92180f1ea
approve.html,1727522244016,a3dab4e1df701f2a5f85c8a627149b261b4337f5f1fefb39bc605de92180f1ea
favicon.ico,1727522244016,a31dff9ecb6b23a890382d0d5f0b7c38608c0c9124bdd841f6983fa4f5370b45
index.html,1727522244017,a3dab4e1df701f2a5f85c8a627149b261b4337f5f1fefb39bc605de92180f1ea
_sitemap.html,1727522244016,a3dab4e1df701f2a5f85c8a627149b261b4337f5f1fefb39bc605de92180f1ea
+not-found.html,1727522244016,a3dab4e1df701f2a5f85c8a627149b261b4337f5f1fefb39bc605de92180f1ea
(tabs)/profile.html,1727522244016,a3dab4e1df701f2a5f85c8a627149b261b4337f5f1fefb39bc605de92180f1ea
(tabs)/tables.html,1727522244016,a3dab4e1df701f2a5f85c8a627149b261b4337f5f1fefb39bc605de92180f1ea
_expo/static/js/web/dotlottie-audio-30a96f406384162d49c55bc97a36935c.js,1727522244070,4790fd2358b9cb6d7d457b57f65d0ecc5b66c801f35f2b7ba174e74c0757bf34
(tabs)/menu.html,1727522244014,a3dab4e1df701f2a5f85c8a627149b261b4337f5f1fefb39bc605de92180f1ea
(tabs)/index.html,1727522244016,a3dab4e1df701f2a5f85c8a627149b261b4337f5f1fefb39bc605de92180f1ea
(tabs)/orders.html,1727522244016,a3dab4e1df701f2a5f85c8a627149b261b4337f5f1fefb39bc605de92180f1ea
_expo/static/js/web/dotlottie-state-machine-manager-2E7RUGJG-9205bf2dca1219df9545f13c3dfabda6.js,1727522244070,e3dbb69a414a6fce8d5f7286ecfd3c98514d2b61851f451189f7d9256f7ee4ff
assets/assets/fonts/SpaceMono-Regular.49a79d66bdea2debf1832bf4d7aca127.ttf,1727522244031,81cb13c8e3ad8314e7da7a33b861eb5ed0a21953dfb50d306ca04599490b7b5c
_expo/static/js/web/lottie_light-KMJEUZFY-7db126b374e91a4fe23b97bbf55b3d0a.js,1727522244069,59228f6783639619fc79fca1601ec901f8356917c83439670b1bf63e98535b15
_expo/static/js/web/lottie_light_html-SLCECTRT-29ef981d46bb85ba1d8b26e60401714d.js,1727522244070,a05e58cc9367f5cfc754ff97431b3b5d8419e5fc047a02688c7356e8f705325c
_expo/static/js/web/lottie_svg-MJGYILXD-0ca9723161614b1303b6bd46ad51a0d9.js,1727522244070,6c9fb8dd4a8389ff4382b5b43286222fc791099860fc582b2ccaa0517fb66516
_expo/static/js/web/lottie_light_canvas-B5UTTNXA-178adc78079062789a9dfa59fce46744.js,1727522244070,97055db87c4833e139a049e4b825d0fb3808c7bac69384be58ac4b1a089272f0
_expo/static/js/web/lottie_html-X3TYKVQI-4b6ff2d05e442f72ecb6d0b97dd3023c.js,1727522244070,9b9a4d983ee3643cc62b03808cecb8ee7045d47b940fae74ebcaf6af1f60b0d3
_expo/static/js/web/lottie_canvas-CDSUBMCL-ab6ca73b2f6068eb8c982dac20d49144.js,1727522244069,119f16fb21cd6ddd34ca66f6f5d2438cb15bf2dc095a1b95e38e5fa757bf479d
_expo/static/js/web/lottie_worker-Q23FJ6ZR-46886a4188f1439061d764eca056295c.js,1727522244070,47cd9c42d14a6f4022ade8ec496f9d1cc44aea3ca69e3dd8eb9b627b3fe38744
assets/assets/images/icon.621dcdbb9e3d7cbc5fc1db1fe90ba641.png,1727522244033,ac9648ac05bc9f1cd2b0c69769f6977beb2749e0893e7ddb616e411951c7ba04
_expo/static/js/web/entry-10696db0e6cfd93279cbad341ee7fb70.js,1727522244083,7f587dacdb7cabcaa7a8a432eb51ac4d062b39b8caa616d99bb38ed6e565a674
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "waiter-dev-ca07d"
}
}
20 changes: 20 additions & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge
on:
push:
branches:
- main
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npx expo export --platform web
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_WAITER_DEV_CA07D }}
channelId: live
projectId: waiter-dev-ca07d
21 changes: 21 additions & 0 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on PR
on: pull_request
permissions:
checks: write
contents: read
pull-requests: write
jobs:
build_and_preview:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npx expo export --platform web
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_WAITER_DEV_CA07D }}
projectId: waiter-dev-ca07d
16 changes: 16 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
51 changes: 51 additions & 0 deletions firebaseConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { initializeApp } from "firebase/app";
import { initializeFirestore, CACHE_SIZE_UNLIMITED } from "firebase/firestore";
import {
getAuth,
initializeAuth,
getReactNativePersistence,
} from "firebase/auth";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { Platform } from "react-native";

// PROD configs
// {Replace DEV configs for PROD builds}

// DEV configs
const firebaseConfig = {
apiKey: "AIzaSyBNlZDqGxMyI83DbW4hY0qd4KAJA3ynW2Q",
authDomain: "waiter-dev-ca07d.firebaseapp.com",
projectId: "waiter-dev-ca07d",
storageBucket: "waiter-dev-ca07d.appspot.com",
messagingSenderId: "699328756162",
appId: "1:699328756162:web:f11e002f4f3dd23bd23e5b",
measurementId: "G-F4YF1WECQR",
};

const app = initializeApp(firebaseConfig);

let auth;

if (Platform.OS === "web") {
auth = getAuth(app);
// Set persistence for web
import("firebase/auth").then(
({ browserLocalPersistence, setPersistence }) => {
setPersistence(auth, browserLocalPersistence);
}
);
} else {
// Initialize auth with AsyncStorage persistence for React Native
auth = initializeAuth(app, {
persistence: getReactNativePersistence(AsyncStorage),
});
}

// Initialize Firestore with persistent local cache
const db = initializeFirestore(app, {
experimentalForceLongPolling: true,
synchronizeTabs: true,
cacheSizeBytes: CACHE_SIZE_UNLIMITED,
});

export { auth, db, firebaseConfig };

0 comments on commit cbe8b33

Please sign in to comment.