diff --git a/.github/workflows/deploy-backend-production.yml b/.github/workflows/deploy-backend-production.yml new file mode 100644 index 0000000..a67010a --- /dev/null +++ b/.github/workflows/deploy-backend-production.yml @@ -0,0 +1,48 @@ +name: Build and Deploy to Google Cloud Run Production + +on: + push: + branches: + - main + paths: + - 'server/**' + workflow_dispatch: + +permissions: + id-token: write + contents: read + +jobs: + build_and_deploy: + runs-on: ubuntu-latest + env: + PROJECT_ID: ${{ secrets.PROJECT_ID }} + APP: chatterbox + REGION: asia-south1 + GAR_LOCATION: asia-south1 + steps: + - name: "Checkout Server Code" + uses: actions/checkout@v4 + with: + sparse-checkout: server + - name: "Google Auth" + uses: "google-github-actions/auth@v2" + with: + workload_identity_provider: "${{ secrets.WIF_PROVIDER }}" + service_account: "${{ secrets.WIF_SERVICE_ACCOUNT }}" + - name: "Set up Cloud SDK" + uses: "google-github-actions/setup-gcloud@v1" + with: + project_id: "${{ secrets.PROJECT_ID }}" + - name: "Docker auth" + run: |- + gcloud auth configure-docker ${{ env.GAR_LOCATION }}-docker.pkg.dev + - name: "Build and push container" + run: |- + docker build -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.APP }}/${{ env.APP }}:production" ./server + docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.APP }}/${{ env.APP }}:production" + - name: "Cloud Run Release" + run : |- + gcloud run services describe my-chat-server --region ${{ env.GAR_LOCATION }} --format export > service.yaml + gcloud run services replace service.yaml + \ No newline at end of file diff --git a/.github/workflows/deploy-backend.yml b/.github/workflows/deploy-backend.yml new file mode 100644 index 0000000..d42eed7 --- /dev/null +++ b/.github/workflows/deploy-backend.yml @@ -0,0 +1,47 @@ +name: Build and Deploy to Google Cloud Run + +on: + workflow_dispatch: + + pull_request: + paths: + - "server/**" + +permissions: + id-token: write + contents: read + +jobs: + build_and_deploy: + runs-on: ubuntu-latest + env: + PROJECT_ID: ${{ secrets.PROJECT_ID }} + APP: chatterbox + REGION: asia-south1 + GAR_LOCATION: asia-south1 + steps: + - name: "Checkout Server Code" + uses: actions/checkout@v4 + with: + sparse-checkout: server + - name: "Google Auth" + uses: "google-github-actions/auth@v2" + with: + workload_identity_provider: "${{ secrets.WIF_PROVIDER }}" + service_account: "${{ secrets.WIF_SERVICE_ACCOUNT }}" + - name: "Set up Cloud SDK" + uses: "google-github-actions/setup-gcloud@v1" + with: + project_id: "${{ secrets.PROJECT_ID }}" + - name: "Docker auth" + run: |- + gcloud auth configure-docker ${{ env.GAR_LOCATION }}-docker.pkg.dev + - name: "Build and push container" + run: |- + docker build -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.APP }}/${{ env.APP }}:staging" ./server + docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.APP }}/${{ env.APP }}:staging" + - name: "Cloud Run Release" + run : |- + gcloud run services describe chatterbox-staging --region ${{ env.GAR_LOCATION }} --format export > service.yaml + gcloud run services replace service.yaml + \ No newline at end of file diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index 7ac6953..c7930d5 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -7,7 +7,6 @@ on: pull_request: paths: - 'client/**' # Only trigger on changes in the client directory - - '.github/**' workflow_dispatch: # Allows manual triggering permissions: diff --git a/client/src/screens/auth/index.tsx b/client/src/screens/auth/index.tsx index ac31233..00645d6 100644 --- a/client/src/screens/auth/index.tsx +++ b/client/src/screens/auth/index.tsx @@ -1,5 +1,5 @@ -import { Box, Button, Container, Divider, Typography } from "@mui/material"; -import HeroSvg from "./HeroSvg.svg"; +import { Button, Container, Typography } from "@mui/material"; +import HeroSvg from "./HeroSvg.svg?react"; import { Google } from "@mui/icons-material"; import { GoogleAuthProvider, @@ -52,7 +52,7 @@ function Auth() { flexDirection: "column", rowGap: 2, my: 1, - maxHeight: 600 + maxHeight: 600, }} > diff --git a/client/src/screens/chat/ChatList.tsx b/client/src/screens/chat/ChatList.tsx index 075ea48..9275b18 100644 --- a/client/src/screens/chat/ChatList.tsx +++ b/client/src/screens/chat/ChatList.tsx @@ -1,4 +1,4 @@ -import BotSVG from "../../assets/bot.svg"; +import BotSVG from "../../assets/bot.svg?react"; import { thumbs } from "@dicebear/collection"; import { createAvatar } from "@dicebear/core"; import { @@ -47,7 +47,6 @@ function MyListItemText({ chat }: { chat: ChatV2 }) { } function MyListItemAudio({ chat }: { chat: ChatV2 }) { - const audioSrc = `data:audio/webm;base64,${chat.data}`; // console.log(audioURL); return ( @@ -106,7 +105,7 @@ export default function ChatList() { {chat.user.displayName === "Chatterbot" ? ( - + ) : ( (() => { const avatar = createAvatar(thumbs, { diff --git a/client/src/vite-env.d.ts b/client/src/vite-env.d.ts index 11f02fe..fa3e1b9 100644 --- a/client/src/vite-env.d.ts +++ b/client/src/vite-env.d.ts @@ -1 +1,2 @@ /// +/// \ No newline at end of file diff --git a/client/vite.config.ts b/client/vite.config.ts index 9d93489..ed0239c 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -4,10 +4,5 @@ import svgr from "vite-plugin-svgr"; // https://vitejs.dev/config/ export default defineConfig({ - plugins: [ - react(), - svgr({ - include: "**/*.svg", - }), - ], + plugins: [react(), svgr()], }); diff --git a/server/app/express.ts b/server/app/express.ts index 68b3c63..d9e816d 100644 --- a/server/app/express.ts +++ b/server/app/express.ts @@ -37,4 +37,8 @@ app.get("/user", async (req, res) => { res.send("done"); }); +app.get("/hello", async (req, res) => { + res.send("Hello from chatterbox!"); +}); + export { app };