-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add workflow file through CLI #64
Changes from 1 commit
f8f22a9
b7f5466
538b98f
2012185
737c7ea
6735b70
16eccd2
2bdf51b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this point is unclear: project re-initialization doesn't happen often. the only case I can think of is if the project gets corrupted. wouldn't it make more sense to check for an updated workflow file when calling I see two scenarios:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes checking during deploy would make more sense. For scenario 1, the message will be displayed in the github actions logs? I also had a doubt. Right now there is just a check to see if the repo workflow file contents is different from the template one. This might happen even if user removes the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought through this, here's my feedback (note that this workflow is different to what I proposed earlier cause I noticed some potential issues):
the reason I'm proposing this is because I feel like prompting users for an answer when running Last call is up to you; think what scenarios users will encounter and define the workflow that makes more sense There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure! I'll start implementing this and if I find any scenario which would be an issue , I'll discuss and modify accordingly. Also, would it be better to store the last updated date in the workflow file? I haven't found a direct way of doing it in the docs, I still needs to explore if it's possible. Because of reasons I mentioned in the above comment:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's ok to tell the user to update only when the contents are different, no need for more complex implementation right now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please refer to this comment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's keep spelling consistent: re-initialise -> re-initialize There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have added more mentions of |
||
|
||
```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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add link here to the section that shows how to store the API key using github's UI