diff --git a/doc/user-guide/github.md b/doc/user-guide/github.md index 70f61a32..e514aa8c 100644 --- a/doc/user-guide/github.md +++ b/doc/user-guide/github.md @@ -2,6 +2,8 @@ You can use GitHub Actions to deploy your project on each push. +## Set Github secret + First, you need to get your [API key](../quickstart/apikey.md). Once you have the API key, you need to store it as a GitHub secret in your repository: @@ -10,6 +12,8 @@ key, you need to store it as a GitHub secret in your repository: ![](../static/github/set-secret.png) +## Initialize project + Then, install the CLI: ```sh @@ -31,6 +35,9 @@ ploomber-cloud init `init` will create a `ploomber-cloud.json` file. For more information on the `init` command, see [](../user-guide/cli.md) +(monitor)= +## Configure and monitor Github actions + Now, configure GitHub actions by adding [this YAML file](https://github.com/edublancas/cloud-template/blob/main/.github/workflows/ploomber-cloud.yaml) in `.github/workflows/ploomber-cloud.yaml` Finally, commit and push the new files: @@ -69,4 +76,28 @@ Without `--watch`, the logs will look like this: ![](../static/github/logs.png) -A complete sample project is [available here.](https://github.com/edublancas/cloud-template) \ No newline at end of file +A complete sample project is [available here.](https://github.com/edublancas/cloud-template) + +## Configure action through CLI + +If your project is already hosted on Github, running `ploomber-cloud init` inside your repository folder will initialize +the project and prompt for configuring Github action: + +```bash +Your app 'snowy-disk-4284' has been configured successfully! +Do you want to configure a github action? [y/N]: +``` + +On confirming with `y` the CLI will create a `ploomber-cloud.yaml` file in the path `.github/workflows`. +In order to trigger an action for deploying the project using Github actions you need to add, commit and push this file along with the `ploomber-cloud.json`. + +Once done, you can monitor progress as discussed [above](monitor). Ensure that the API key is set as Github secret. + +In case the [workflow template](https://github.com/edublancas/cloud-template/blob/main/.github/workflows/ploomber-cloud.yaml) has been updated, and you need to re-initialise the application the CLI will prompt your for updating the workflow file: + +```bash +Your app 'red-river-8187' has been configured successfully! +.github/workflows/ploomber-cloud.yaml seems outdated. Do you want to configure a github action? [y/N]: +``` + +Please review the workflow file and update if needed. \ No newline at end of file