Skip to content

Commit

Permalink
Add firebase functions github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Gojodzojo committed May 4, 2022
1 parent be3fd4d commit 3f07637
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 6 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/firebase-functions-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copied from https://mdabdulhalimrafi.medium.com/automate-firebase-functions-deployment-with-github-actions-ci-a0eb10fa308d

name: Firebase function deploy
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install npm packages
run: |
cd functions
npm install
- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only functions
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ testem.log
# System files
.DS_Store
Thumbs.db

*.log
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
30 changes: 28 additions & 2 deletions firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
]
],
"source": "functions"
},
"hosting": {
"public": "dist/watering-reminder",
Expand All @@ -22,5 +23,30 @@
"destination": "/index.html"
}
]
},
"emulators": {
"auth": {
"host": "127.0.0.1",
"port": 9099
},
"functions": {
"host": "127.0.0.1",
"port": 5001
},
"firestore": {
"host": "127.0.0.1",
"port": 8080
},
"hosting": {
"host": "127.0.0.1",
"port": 5000
},
"pubsub": {
"host": "127.0.0.1",
"port": 8085
},
"ui": {
"enabled": true
}
}
}
}
8 changes: 4 additions & 4 deletions functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as functions from "firebase-functions";
// // Start writing Firebase Functions
// // https://firebase.google.com/docs/functions/typescript
//
// export const helloWorld = functions.https.onRequest((request, response) => {
// functions.logger.info("Hello logs!", {structuredData: true});
// response.send("Hello from Firebase!");
// });
export const helloWorld = functions.https.onRequest((request, response) => {
functions.logger.info("Hello logs!", {structuredData: true});
response.send("Hello from Firebase!");
});

0 comments on commit 3f07637

Please sign in to comment.