-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,55 @@ | ||
# This file was auto-generated by the Firebase CLI | ||
# https://github.com/firebase/firebase-tools | ||
name: Build and Deploy | ||
|
||
name: Deploy to Firebase Hosting on merge | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build_and_deploy: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: npm ci && npm run build | ||
- uses: FirebaseExtended/action-hosting-deploy@v0 | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Create package.json if it doesn't exist | ||
run: | | ||
if [ ! -f package.json ]; then | ||
echo '{ | ||
"name": "madj101", | ||
"version": "1.0.0", | ||
"description": "Mobile App Development for Juniors", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "Raydo Matthee", | ||
"license": "ISC", | ||
"dependencies": {} | ||
}' > package.json | ||
fi | ||
- name: Install dependencies | ||
run: | | ||
if [ -f package-lock.json ]; then | ||
npm ci | ||
else | ||
npm install | ||
fi | ||
- name: Build project | ||
run: npm run build | ||
|
||
- name: Deploy to Firebase Hosting | ||
uses: FirebaseExtended/action-hosting-deploy@v0 | ||
with: | ||
repoToken: ${{ secrets.GITHUB_TOKEN }} | ||
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_COURSE_MADJ101 }} | ||
channelId: live | ||
projectId: course-madj101 | ||
channelId: live |