Skip to content

Commit

Permalink
Dev (#54)
Browse files Browse the repository at this point in the history
design changes and workflow updates

---------

Co-authored-by: Ishan Sasanka <166486873+dmisasanka2002@users.noreply.github.com>
  • Loading branch information
SakinduRansindu and dmisasanka2002 authored Dec 27, 2024
1 parent de97955 commit 66efcc3
Show file tree
Hide file tree
Showing 55 changed files with 485 additions and 334 deletions.
16 changes: 13 additions & 3 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"projects": {
"default": "firetest-c524f"
}
}
"default": "rur-24"
},
"targets": {
"rur-24": {
"hosting": {
"rur25-official-web": [
"rur-24"
]
}
}
},
"etags": {}
}
34 changes: 34 additions & 0 deletions .github/workflows/firebase-functions-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy Firebase Functions

on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize

jobs:
build_and_deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install dependencies
working-directory: functions
run: npm install

- name: Deploy to Firebase Functions
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
run: |
npm install -g firebase-tools
firebase deploy --only functions --project rur-24
53 changes: 0 additions & 53 deletions .github/workflows/firebase-hosting-merge-production.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# 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:
- dev
- main
jobs:
build_and_deploy:
runs-on: ubuntu-latest
Expand All @@ -16,16 +19,11 @@ jobs:
NEXT_PUBLIC_STATUS: ${{ secrets.NEXT_PUBLIC_STATUS }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies and build
run: npm ci && npm run build

- name: Deploy to Firebase Hosting
uses: FirebaseExtended/action-hosting-deploy@v0
- uses: actions/checkout@v4
- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_FIRETEST_C524F }}
channelId: live
projectId: firetest-c524f
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_RUR_24 }}
projectId: rur-24
target: rur25-official-web
46 changes: 10 additions & 36 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,30 @@
# 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
env:
env: # Set environment variables at the job level
NEXT_PUBLIC_API_KEY: ${{ secrets.NEXT_PUBLIC_API_KEY }}
NEXT_PUBLIC_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_AUTH_DOMAIN }}
NEXT_PUBLIC_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_PROJECT_ID }}
NEXT_PUBLIC_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_STORAGE_BUCKET }}
NEXT_PUBLIC_MESSAGING_SENDER_ID: ${{ secrets.NEXT_PUBLIC_MESSAGING_SENDER_ID }}
NEXT_PUBLIC_APP_ID: ${{ secrets.NEXT_PUBLIC_APP_ID }}
NEXT_PUBLIC_STATUS: ${{ secrets.NEXT_PUBLIC_STATUS }}
FIREBASE_DEPLOY_TOKEN: ${{ secrets.FIREBASE_DEPLOY_TOKEN }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.npm # Cache global npm cache
${{ github.workspace }}/.next/cache # Cache Next.js build cache
${{ github.workspace }}/functions/node_modules # Cache Firebase Functions dependencies
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Install dependencies and build
run: npm ci && npm run build

- name: Deploy to Firebase Hosting
uses: FirebaseExtended/action-hosting-deploy@v0
- uses: actions/checkout@v4
- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_FIRETEST_C524F }}
projectId: firetest-c524f

- name: Install Firebase CLI
run: npm install -g firebase-tools

- name: Deploy Firebase Functions
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_DEPLOY_TOKEN }}
run: |
cd functions
npm ci
firebase deploy --only functions --project firetest-c524f
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_RUR_24 }}
projectId: rur-24
target: rur25-official-web
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[<img alt="Deployed with FTP Deploy Action" src="https://img.shields.io/badge/Deployed With-FTP DEPLOY ACTION-%3CCOLOR%3E?style=for-the-badge&color=0077b6">](https://github.com/SamKirkland/FTP-Deploy-Action)

This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started
Expand Down
10 changes: 2 additions & 8 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
{
"hosting": {
"public": "out",
"public": "./out",
"target": "rur25-official-web",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
"functions": [
{
"source": "functions",
"codebase": "default",
"region": "asia-southeast1",
"ignore": [
"node_modules",
".git",
Expand Down
77 changes: 77 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 66efcc3

Please sign in to comment.