Skip to content

Commit

Permalink
Merge pull request #84 from weaponsforge/dev
Browse files Browse the repository at this point in the history
v1.0.2
  • Loading branch information
weaponsforge authored Mar 14, 2023
2 parents 03869f6 + 962a763 commit f472a9b
Show file tree
Hide file tree
Showing 83 changed files with 11,280 additions and 536 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
npm-debug.log
Dockerfile
.dockerignore
.vercel
53 changes: 53 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
runs-on: ubuntu-latest
env:
NEXT_PUBLIC_BASE_PATH: ''
NEXT_PUBLIC_BASE_API_URL: ${{ secrets.NEXT_PUBLIC_BASE_API_URL_DEV }}
NEXT_PUBLIC_FIREBASE_WEB_API_KEY: ${{ secrets.FIREBASE_WEB_API_KEY_DEV }}
NEXT_PUBLIC_FIREBASE_WEB_AUTHDOMAIN: ${{ secrets.FIREBASE_WEB_AUTHDOMAIN_DEV }}
NEXT_PUBLIC_FIREBASE_WEB_PROJECT_ID: ${{ secrets.FIREBASE_WEB_PROJECT_ID_DEV }}
Expand Down Expand Up @@ -52,6 +53,22 @@ jobs:
client/firebase.json
retention-days: 3

lint-server:
name: Lint Server
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Use NodeJS v18.14.2
uses: actions/setup-node@v3
with:
node-version: 18.14.2
- name: Install Dependencies and lint
run: |
cd server
npm install
npm run lint
deploy-client:
name: Deploy Client to Firebase Hosting
needs: lint-export-client
Expand All @@ -67,3 +84,39 @@ jobs:
args: deploy --only hosting:dev
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

deploy-server:
name: Deploy Server to Vercel
needs: lint-server
runs-on: ubuntu-latest
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID_DEV }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_DEV }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Use NodeJS v18.14.2
uses: actions/setup-node@v3
with:
node-version: 18.14.2
- name: Install Vercel CLI
run: npm install --global vercel@28.16.7
- name: Pull Vercel Environment Information
run: |
cd server
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: |
cd server
npm install
npm run docs:vercel
vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: |
cd server
vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Post Deployment Clean-up
run: |
cd server
rm -r -f .vercel
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
runs-on: ubuntu-latest
env:
NEXT_PUBLIC_BASE_PATH: ${{ secrets.NEXT_PUBLIC_BASE_PATH }}
NEXT_PUBLIC_BASE_API_URL: ${{ secrets.NEXT_PUBLIC_BASE_API_URL_PROD }}
BASE_API_URL: ${{ secrets.BASE_API_URL }}
NEXT_PUBLIC_FIREBASE_WEB_API_KEY: ${{ secrets.FIREBASE_WEB_API_KEY_PROD }}
NEXT_PUBLIC_FIREBASE_WEB_AUTHDOMAIN: ${{ secrets.FIREBASE_WEB_AUTHDOMAIN_PROD }}
Expand Down Expand Up @@ -57,6 +58,22 @@ jobs:
path: client/out
retention-days: 3

lint-server:
name: Lint Server
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Use NodeJS v18.14.2
uses: actions/setup-node@v3
with:
node-version: 18.14.2
- name: Install Dependencies and lint
run: |
cd server
npm install
npm run lint
deploy-client:
name: Deploy client to Github Pages
needs: lint-client
Expand All @@ -76,3 +93,39 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./
publish_branch: gh-pages

deploy-server:
name: Deploy Server to Vercel
needs: lint-server
runs-on: ubuntu-latest
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID_PROD }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_PROD }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Use NodeJS v18.14.2
uses: actions/setup-node@v3
with:
node-version: 18.14.2
- name: Install Vercel CLI
run: npm install --global vercel@28.16.7
- name: Pull Vercel Environment Information
run: |
cd server
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: |
cd server
npm install
npm run docs:vercel
vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: |
cd server
vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Post Deployment Clean-up
run: |
cd server
rm -r -f .vercel
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@ My Phonebook will consist of a front-end website (client) and a secure REST API

> This project will also serve as a practice for catching up and implementing best practices for using React, Firebase, Express and general software development.
### Live Preview
## Live Preview

https://weaponsforge.github.io/my-phonebook/
### Production

Website: https://weaponsforge.github.io/my-phonebook/<br>
Server: https://myphonebook-app.vercel.app/

### Development

Website: https://myphonebook-app-dev.web.app/<br>
Server: https://myphonebook-app-dev.vercel.app/

## Software Documentation

Expand Down
17 changes: 9 additions & 8 deletions client/.env.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
NEXT_PUBLIC_BASE_PATH=''
NEXT_PUBLIC_FIREBASE_WEB_API_KEY=AIzaSyDIdds0QEYfS_GFbARrAU53AmvxH-HCcRU
NEXT_PUBLIC_FIREBASE_WEB_AUTHDOMAIN=my-phonebook-dev.firebaseapp.com
NEXT_PUBLIC_FIREBASE_WEB_PROJECT_ID=my-phonebook-dev
NEXT_PUBLIC_FIREBASE_WEB_STORAGE_BUCKET=my-phonebook-dev.appspot.com
NEXT_PUBLIC_FIREBASE_WEB_MESSAGING_SENDER_ID=240072530372
NEXT_PUBLIC_FIREBASE_WEB_APP_ID=1:240072530372:web:9bece433da7e2e56b4ec91
NEXT_PUBLIC_FIREBASE_WEB_MEASUREMENT_ID=G-MYW833GXV6
NEXT_PUBLIC_BASE_API_URL=http://localhost:3001
NEXT_PUBLIC_FIREBASE_WEB_API_KEY=AIzaSyDAZxPcy_4XMVcZJ0nIupEGBcGZoABlNU4
NEXT_PUBLIC_FIREBASE_WEB_AUTHDOMAIN=myphonebook-app-dev.firebaseapp.com
NEXT_PUBLIC_FIREBASE_WEB_PROJECT_ID=myphonebook-app-dev
NEXT_PUBLIC_FIREBASE_WEB_STORAGE_BUCKET=myphonebook-app-dev.appspot.com
NEXT_PUBLIC_FIREBASE_WEB_MESSAGING_SENDER_ID=458788271773
NEXT_PUBLIC_FIREBASE_WEB_APP_ID=1:458788271773:web:a3c1edf29f5b86da8f4674
NEXT_PUBLIC_FIREBASE_WEB_MEASUREMENT_ID=G-64M5K063SC
NEXT_PUBLIC_RANDOM_JOKE_API=https://v2.jokeapi.dev/joke/Misc?format=json&safe-mode&type=single
NEXT_PUBLIC_MEDIA_BG1=https://firebasestorage.googleapis.com/v0/b/my-phonebook-pro.appspot.com/o/media%2Fimages%2Fpexels-pixabay-101529.jpg?alt=media&token=24e8132a-8c2e-4c28-bad5-1ab35b82607e
NEXT_PUBLIC_MEDIA_BG1=https://firebasestorage.googleapis.com/v0/b/myphonebook-app.appspot.com/o/assets%2Fimages%2Fpexels-pixabay-101529.jpg?alt=media&token=a7c555b7-1ddb-43cb-82ec-fe9048c6d007
6 changes: 3 additions & 3 deletions client/.firebaserc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"projects": {
"default": "my-phonebook-dev"
"default": "myphonebook-app-dev"
},
"targets": {
"my-phonebook-dev": {
"myphonebook-app-dev": {
"hosting": {
"dev": [
"my-phonebook-dev"
"myphonebook-app-dev"
]
}
}
Expand Down
3 changes: 2 additions & 1 deletion client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This directory contains the web user interfaces (UI) for interacting with My Pho

### Live Apps

Development: https://my-phonebook-dev.web.app/<br>
Development: https://myphonebook-app-dev.web.app/<br>
Production: https://weaponsforge.github.io/my-phonebook/

## Requirements
Expand Down Expand Up @@ -42,6 +42,7 @@ The following dependecies are used for this project. Feel free to experiment usi
| Variable Name | Description |
| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| NEXT_PUBLIC_BASE_PATH | This variable is the directory name where NextJS loads the app.<br><br>Set its value to blank `''` when working on development mode in localhost.<br>Set its value to the sub-directory name where the exported NextJS app is to be deployed, i.e. `/<YOUR_REPOSITORY_NAME>` when deploying on a repository (sub-directory) of a root GitHub Pages site. |
| NEXT_PUBLIC_BASE_API_URL | My Phonebook's server base API url minuse the forward slash. |
| NEXT_PUBLIC_FIREBASE_WEB_API_KEY | Firebase web API key from the Firebase Project Settings configuration file. |
| NEXT_PUBLIC_FIREBASE_WEB_AUTHDOMAIN | Firebase web auth domain key from the Firebase Project Settings configuration file. |
| NEXT_PUBLIC_FIREBASE_WEB_PROJECT_ID | Firebase web project ID from the Firebase Project Settings configuration file. |
Expand Down
91 changes: 91 additions & 0 deletions client/package-lock.json

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

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@mui/material": "^5.11.10",
"@mui/x-data-grid": "^5.17.25",
"@reduxjs/toolkit": "^1.9.3",
"axios": "^1.3.4",
"eslint": "8.34.0",
"eslint-config-next": "13.2.1",
"firebase": "^9.17.1",
Expand Down
Loading

0 comments on commit f472a9b

Please sign in to comment.