File tree Expand file tree Collapse file tree 3 files changed +223
-262
lines changed Expand file tree Collapse file tree 3 files changed +223
-262
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ It performs a few steps to deploy:
34
34
5 . Deploys the code to the cloud.
35
35
6 . Registers the tasks as a new version in the environment (prod by default).
36
36
37
+ You can also setup [ GitHub Actions] ( /github-actions ) to deploy your tasks automatically.
38
+
37
39
## Options
38
40
39
41
### Environment ` --env ` or ` -e `
Original file line number Diff line number Diff line change @@ -175,3 +175,56 @@ return {
175
175
```
176
176
177
177
This should mean that for most secret services you won't need to convert the data into a different format.
178
+
179
+ ### Using Google credential JSON files
180
+
181
+ Securely pass a Google credential JSON file to your Trigger.dev task using environment variables.
182
+
183
+ <Steps >
184
+
185
+ <Step title = " Convert the Google credential file to base64" >
186
+
187
+ In your terminal, run the following command and copy the resulting base64 string:
188
+
189
+ ```
190
+ base64 path/to/your/service-account-file.json
191
+ ```
192
+
193
+ </Step >
194
+
195
+ <Step title = " Set up the environment variable in Trigger.dev" >
196
+
197
+ Follow [ these steps] ( /deploy-environment-variables ) to set a new environment variable using the base64 string as the value.
198
+
199
+ ```
200
+ GOOGLE_CREDENTIALS_BASE64="<your base64 string>"
201
+ ```
202
+
203
+ </Step >
204
+
205
+ <Step title = " Use the environment variable in your code" >
206
+
207
+ Add the following code to your Trigger.dev task:
208
+
209
+ ``` ts
210
+ import { google } from ' googleapis' ;
211
+
212
+ const credentials = JSON .parse (Buffer .from (process .env .GOOGLE_CREDENTIALS_BASE64 , ' base64' ).toString (' utf8' ));
213
+
214
+ const auth = new google .auth .GoogleAuth ({
215
+ credentials ,
216
+ scopes: [' https://www.googleapis.com/auth/cloud-platform' ],
217
+ });
218
+
219
+ const client = await auth .getClient ();
220
+ ```
221
+
222
+ </Step >
223
+
224
+ <Step title = " Use the client in your code" >
225
+
226
+ You can now use the ` client ` object to make authenticated requests to Google APIs
227
+
228
+ </Step >
229
+
230
+ </Steps >
You can’t perform that action at this time.
0 commit comments