Repository navigation
v2: deploy openfn.yaml workspaces with openfn project deploy #7
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b54b836
v2: deploy openfn.yaml workspaces with openfn project deploy
midigofrank 1b37272
Make endpoint_input optional
midigofrank a9e664d
allow workspace configuration
midigofrank db944c3
Install the latest @openfn/cli
midigofrank ca8d6dd
Split CLI install into its own step, add --log info, drop OPENFN_NO_C…
midigofrank File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,42 @@ | ||
| #OpenFN Github Deploy Action | ||
| # OpenFn GitHub Deploy Action | ||
|
|
||
| This action deploys to a specific Lightning instance whenever it is invoked. | ||
| Deploys an OpenFn project workspace to Lightning using `openfn project deploy`, | ||
| then commits the updated project state back to the branch. | ||
|
|
||
| It depends on an repository containing the following | ||
| The repository must contain an `openfn.yaml` workspace (as created by | ||
| `openfn project pull` or by Lightning's GitHub sync). Commit the `.openfn/` | ||
| folder: deploy uses it to detect changes made in Lightning since the last sync. | ||
|
|
||
| 1. A `state.json` file which details ids and jobs in a project | ||
| 2. A `project.yaml` file detailing a project its workflows, edges and triggers | ||
| 3. A `config.json` file detailing a connection to a Lightning instance | ||
| `endpoint_input` is optional. Without it, the CLI uses the endpoint the | ||
| workspace already tracks for the project, then `OPENFN_ENDPOINT`, then | ||
| app.openfn.org. | ||
|
|
||
| Additionally one needs to pass in their OPENFN API KEY to the action as an input best way to do this would be through | ||
| an input. The required key is `secret_input` | ||
| > `v1` of this action uses the legacy `config.json` / `openfn deploy` format. | ||
| > Pin to `@v1` if your repo still uses it. | ||
|
|
||
| See an example project structure [here](https://github.com/OpenFn/dummy-deploy-test) | ||
|
|
||
| An example of how to use this action in workflow | ||
| ``` | ||
| ```yaml | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
| inputs: | ||
| force: | ||
| type: boolean | ||
| default: false | ||
|
|
||
| jobs: | ||
| deploy-to-lightning: | ||
| runs-on: ubuntu-latest | ||
| name: Deploy this project to OpenFn/Lightning | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Deploy to Lightning | ||
| uses: openfn/deploy-action@v0.1.9 | ||
| with: | ||
| - name: openfn deploy | ||
| uses: openfn/cli-deploy-action@v2 | ||
| with: | ||
| secret_input: ${{ secrets.OPENFN_API_KEY }} | ||
| project_id_input: <project uuid> | ||
| endpoint_input: https://app.openfn.org | ||
| force_input: ${{ inputs.force || false }} | ||
| workspace_input: projects/my-project # optional, defaults to the repo root | ||
| ``` | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we add
--log infohere?It might not make a lot of difference right now but I'd like to have the hook in place for richer output.
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.
Done