I have a situation where I want to deploy my whole index file through cloud build using cloudbuild.yaml file but didn't find any way to do so like in firebase we do like firebase deploy --only function:functionName or fileName (in which all functions exists), is there any way to do the same through cloud build.
I have pasted my index.js, main.js and cloudbuild.yaml file below. Please have a look and suggest over this.
// index.js
const fourthFunc = require('./main');
exports.fourthFunction = fourthFunc;
exports.firstFunc = functions.https.onCall((data, context)=>{
try{
return "first function"
}catch(err){
return err.message
}
})
exports.secondFunc = functions.https.onCall((data, context)=>{
try{
return 'second function'
}catch(err){
return err.message;
}
})
exports.thirdFunc = functions.https.onCall((data, context)=>{
try{
return 'third function'
}catch(err){
return err.message;
}
})```
// main.js
```const functions = require("firebase-functions");
exports.fourthFunc = functions.https.onRequest((req, res)=>{
try{
return "fourth function"
}catch(err){
return err.message;
}
})```
// cloudbuild.yaml
```steps:
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
args:
- gcloud
- functions
- deploy
- firstFunc
- --region=us-central1
- --source=./functions
- --trigger-http
- --allow-unauthenticated
- --runtime=nodejs16```