Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #214 from COS301-SE-2023/WIP-61-ISSUE-multisite-ho…
Browse files Browse the repository at this point in the history
…st-for-pre-release

Wip 61 issue multisite host for pre release
  • Loading branch information
u18004874 authored Sep 22, 2023
2 parents d42de01 + 00396c6 commit 20a1fa0
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 10 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/firebase_dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and Deploy app to DEV site
'on':
push:
branches:
- dev

jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: "18"

- name: Install Dependencies
working-directory: ./app/WhereIsThePower
run: npm install --frozen-lock

- name: Inject Developer tags
run: |
sed -i 's|<!-- DEVELOPER SITE INJECTION -->|<ion-item><ion-title style="background-color: red; color: white;">DEVELOPER SITE</ion-title></ion-item>|g' app/WhereIsThePower/src/app/app.component.html
sed -i 's|<title>Where Is The Power|<title>WITP-DEV|g' app/WhereIsThePower/src/index.html
sed -i 's|href="assets/icon/favicon.ico"|href="assets/Ramp.svg"|g' app/WhereIsThePower/src/index.html
- name: update Prod ENV file
run: |
sed -i 's/HelloAPIKey/${{ secrets.MAPBOX_API_KEY }}/g' app/WhereIsThePower/src/environments/environment.prod.ts
- name: Build app
working-directory: ./app/WhereIsThePower
run: npm run build

- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_WHEREISTHEPOWER_33A66 }}'
channelId: live
projectId: whereisthepower-33a66
target: dev
entrypoint: ./app/WhereIsThePower
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merg
name: Build and Deploy app to PROD site
'on':
push:
branches:
- dev
- main

jobs:
build_and_deploy:
runs-on: ubuntu-latest
Expand All @@ -21,18 +18,22 @@ jobs:
working-directory: ./app/WhereIsThePower
run: npm install --frozen-lock

- name: Remove consolelogs from production site
run: echo "if(window) { window.console.log = function() {}; }" >> app/WhereIsThePower/src/main.ts

- name: update Prod ENV file
run: |
sed -i 's/HelloAPIKey/${{ secrets.MAPBOX_API_KEY }}/g' app/WhereIsThePower/src/environments/environment.prod.ts
sed -i 's/HelloAPIKey/${{ secrets.MAPBOX_API_KEY }}/g' app/WhereIsThePower/src/environments/environment.prod.ts
- name: Build app
working-directory: ./app/WhereIsThePower
run: npm run build && cat ./src/environments/environment.ts
run: npm run build

- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_WHEREISTHEPOWER_33A66 }}'
channelId: live
projectId: whereisthepower-33a66
target: prod
entrypoint: ./app/WhereIsThePower
17 changes: 15 additions & 2 deletions app/WhereIsThePower/.firebaserc
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
{
"projects": {
"default": "whereisthepower-33a66"
}
}
},
"targets": {
"whereisthepower-33a66": {
"hosting": {
"prod": [
"whereisthepower-33a66"
],
"dev": [
"whereisthepowerdev"
]
}
}
},
"etags": {}
}
49 changes: 48 additions & 1 deletion app/WhereIsThePower/firebase.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
{
"hosting": {
"hosting":[
{
"target": "prod",
"public": "www",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"headers": [
{
"source": "**",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache, no-store, must-revalidate"
}
]
},
{
"source": "**/*.@(jpg|jpeg|gif|png|svg|webp|js|css|eot|otf|ttf|ttc|woff|font.css)",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache"
}
]
},
{
"source": "ngsw-worker.js",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache"
}
]
}
]
},
{
"target": "dev",
"public": "www",
"ignore": [
"firebase.json",
Expand Down Expand Up @@ -42,4 +88,5 @@
}
]
}
]
}
2 changes: 2 additions & 0 deletions app/WhereIsThePower/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ <h2>Where is the Power?</h2>
<ion-icon slot="start" name="person-circle"></ion-icon>
<ion-label>Profile</ion-label>
</ion-item>

<!-- DEVELOPER SITE INJECTION -->
</ion-menu-toggle>
</ion-list>
</ion-content>
Expand Down

0 comments on commit 20a1fa0

Please sign in to comment.