Skip to content

Commit 569dcf4

Browse files
authored
Docs improvements (#1284)
* Separated the triggering docs page into 2 sections * Added link to GitHub Actions from deploy page * Improved the batchTriggerAndWait docs for handling errors * Added docs for using google credential files * Improved the triggering page copy some more * Improved the google credentials copy
1 parent 87e46d4 commit 569dcf4

File tree

3 files changed

+223
-262
lines changed

3 files changed

+223
-262
lines changed

docs/cli-deploy.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ It performs a few steps to deploy:
3434
5. Deploys the code to the cloud.
3535
6. Registers the tasks as a new version in the environment (prod by default).
3636

37+
You can also setup [GitHub Actions](/github-actions) to deploy your tasks automatically.
38+
3739
## Options
3840

3941
### Environment `--env` or `-e`

docs/deploy-environment-variables.mdx

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,56 @@ return {
175175
```
176176

177177
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>

0 commit comments

Comments
 (0)