|
1 | | -# kedro-viz-share |
2 | | -Publish and share Kedro-Viz static website on GitHub pages in your workflow through this GitHub action |
| 1 | +# Publish-kedro-viz |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | +<br /> |
| 7 | +<p align="center"> |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +</p> |
| 12 | + |
| 13 | +<p align="center"> |
| 14 | +✨ <em> Data Science Pipelines. Beautifully Designed</em> ✨ |
| 15 | +<br /> |
| 16 | +Live Demo: <a href="https://demo.kedro.org/" target="_blank">https://demo.kedro.org/</a> |
| 17 | +</p> |
| 18 | + |
| 19 | +<br /> |
| 20 | + |
| 21 | +## Overview |
| 22 | + |
| 23 | +Publish-kedro-viz is a GitHub action that simplifies the process of deploying Kedro-viz, which is a visual representation of your Kedro project, directly within the Git repository where your Kedro project is stored. By using this action, you can effortlessly showcase your Kedro-viz on GitHub Pages. |
| 24 | + |
| 25 | +This action helps in the automation of a deployment strategy mentioned in [platform agnostic sharing with Kedro-Viz](https://docs.kedro.org/projects/kedro-viz/en/v8.0.1/platform_agnostic_sharing_with_kedro_viz.html#static-website-hosting-platforms-such-as-github-pages) |
| 26 | + |
| 27 | +## Prerequisites |
| 28 | + |
| 29 | +- **GitHub Repository:** A GitHub repository with your Kedro project. |
| 30 | +- **GitHub Pages Setup:** Configure your repository for [GitHub Pages](https://docs.github.com/en/pages/quickstart). |
| 31 | +- **Kedro-project dependencies:** Install all the Kedro-project dependencies before using this action in your workflow. |
| 32 | +- **Python-version:** You need to have an environment with `python>=3.9` in your workflow. |
| 33 | + |
| 34 | +**NOTE:** While configuring your repository for GitHub Pages, you have two publishing source options. You can either choose a branch or a custom GitHub Actions workflow. If you choose a branch, the build artifacts will be uploaded to the `publish_branch` you pass as an input to the action, which defaults to `gh-pages`. If you choose a custom GitHub Actions workflow, you need to mention that in the input `publishing_source` to the action. In this case, no branch will be created and the artifacts are deployed at run-time. Please find more information on configuring a publishing source for github pages site in the [official docs](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site). |
| 35 | + |
| 36 | + |
| 37 | +## Usage |
| 38 | + |
| 39 | +```yaml |
| 40 | + |
| 41 | +- uses: kedro-org/publish-kedro-viz@v1 |
| 42 | + with: |
| 43 | + # The GitHub token to authenticate deployment. This is autogenerated by the action. |
| 44 | + # Default: ${{ github.token }} |
| 45 | + github_token: '' |
| 46 | + |
| 47 | + # The Kedro-project path to build the Kedro-Viz artifacts. |
| 48 | + # Default: '.' |
| 49 | + project_path: '' |
| 50 | + |
| 51 | + # Your consent to participate in Kedro-Telemetry. |
| 52 | + # Default: true |
| 53 | + telemetry_consent: '' |
| 54 | + |
| 55 | + # The publishing source for GitHub pages. This can be either |
| 56 | + # 'branch' or 'workflow' based on your GitHub Pages configuration |
| 57 | + # Default: 'branch' |
| 58 | + publishing_source: '' |
| 59 | + |
| 60 | + # The GitHub pages publish branch to upload the artifacts |
| 61 | + # if your publishing_source is a branch |
| 62 | + # Default: 'gh-pages' |
| 63 | + publish_branch: '' |
| 64 | + |
| 65 | + # The commit message for the deployment, if your publishing_source is a branch. |
| 66 | + # Defaults to your original commit message. |
| 67 | + # Default: ${{ github.event.head_commit.message }} |
| 68 | + commit_message: '' |
| 69 | + |
| 70 | + # An option to publish branch with only the latest commit |
| 71 | + # if your publishing_source is a branch. |
| 72 | + # Default: true |
| 73 | + force_orphan: '' |
| 74 | + |
| 75 | + # The git config user.name or the owner of the commit. |
| 76 | + # if your publishing_source is a branch. |
| 77 | + # Default: 'github-actions[bot]' |
| 78 | + user_name: '' |
| 79 | + |
| 80 | + # The git config user.email or the email of the commit owner. |
| 81 | + # if your publishing_source is a branch. |
| 82 | + # Default: 'github-actions[bot]@users.noreply.github.com' |
| 83 | + user_email: '' |
| 84 | + |
| 85 | +``` |
| 86 | + |
| 87 | +## Configure the action |
| 88 | + |
| 89 | +1. Adding the GitHub Action to your workflow: |
| 90 | + |
| 91 | + 1. Create a workflow file in your repository: `.github/workflows/publish-kedro-viz.yml` |
| 92 | + 2. Add the following code to the workflow file: |
| 93 | + |
| 94 | + ```yaml |
| 95 | + # An example workflow configuration |
| 96 | + |
| 97 | + # The name of your workflow |
| 98 | + name: Publish and share Kedro Viz |
| 99 | + |
| 100 | + permissions: |
| 101 | + |
| 102 | + # The contents write permission is required to use the action |
| 103 | + # if your GitHub publishing source is a branch |
| 104 | + contents: write |
| 105 | + |
| 106 | + # The pages and id-token write permissions are required to use |
| 107 | + # the action if your GitHub publishing source is a custom |
| 108 | + # GitHub Actions workflow |
| 109 | + pages: write |
| 110 | + id-token: write |
| 111 | + |
| 112 | + on: |
| 113 | + # This can be configured based on your requirements |
| 114 | + # (i.e., the workflow trigger condition) |
| 115 | + pull_request: |
| 116 | + push: |
| 117 | + branches: |
| 118 | + - main |
| 119 | + workflow_dispatch: |
| 120 | + |
| 121 | + # We mentioned the minimal jobs for the workflow |
| 122 | + jobs: |
| 123 | + deploy: |
| 124 | + # The action is currently tested on ubuntu-latest (Recommended) |
| 125 | + runs-on: ubuntu-latest |
| 126 | + steps: |
| 127 | + - name: Fetch the repository |
| 128 | + uses: actions/checkout@v4 |
| 129 | + - name: Set up Python |
| 130 | + uses: actions/setup-python@v5 |
| 131 | + with: |
| 132 | + # Requires python >= 3.9 |
| 133 | + python-version: 3.11 |
| 134 | + # This installs the Kedro-project dependencies |
| 135 | + - name: Install Project Dependencies |
| 136 | + run: | |
| 137 | + python -m pip install --upgrade pip |
| 138 | + # This is not required if your Kedro Project |
| 139 | + # is at the root of your GitHub Repository |
| 140 | + cd demo-project |
| 141 | + pip install -r requirements.txt |
| 142 | + # Using the action |
| 143 | + - name: Deploy Kedro-Viz to GH Pages |
| 144 | + uses: kedro-org/publish-kedro-viz@v1 |
| 145 | + with: |
| 146 | + # This is not required if your Kedro Project |
| 147 | + # is at the root of your GitHub Repository |
| 148 | + project_path: 'demo-project' |
| 149 | + ``` |
| 150 | +
|
| 151 | +## Test the action |
| 152 | +
|
| 153 | +After you've completed the configuration, trigger the workflow as per the workflow trigger condition. |
| 154 | +
|
| 155 | +- Once triggered, the GitHub workflow "Publish and share Kedro Viz" will automatically start and can be found in the Actions tab with your commit message. |
| 156 | +- If your GitHub Pages publishing source is a branch, then the artifacts of your Kedro-Viz static site will be uploaded to the publish-branch input specified in the action upon successful completion of the workflow. |
| 157 | +- If your GitHub Pages publishing source is a custom GitHub Actions workflow, then the artifacts of your Kedro-Viz static site will be uploaded and deployed during the workflow run-time. |
| 158 | +- You can access the static site at `http://<username>.github.io/<repo-name>` |
| 159 | + |
| 160 | +## Credits |
| 161 | + |
| 162 | +The list of third party actions used in this project, with due credits to their authors and license terms. More details can be found inside the folder of each action. |
| 163 | + |
| 164 | +### Deploy to GitHub Pages when publishing source is a branch |
| 165 | + |
| 166 | +We use the GitHub action [peaceiris/actions-gh-pages](https://github.com/peaceiris/actions-gh-pages) to deploy the static site to a publish branch which is released under MIT license. |
| 167 | + |
| 168 | +### Deploy to GitHub Pages when publishing source is a custom GitHub Action Workflow |
| 169 | + |
| 170 | +We use the GitHub actions [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) and [actions/deploy-pages](https://github.com/actions/deploy-pages) which are released under MIT license. |
| 171 | + |
| 172 | +## License |
| 173 | + |
| 174 | +publish-kedro-viz is licensed under the [Apache 2.0](https://github.com/kedro-org/publish-kedro-viz/blob/main/LICENSE.md) License. |
0 commit comments