|
| 1 | +--- |
| 2 | +title: Deploy your Spark app from the command line |
| 3 | +shortTitle: Deploy from CLI |
| 4 | +intro: 'Learn how to deploy your {% data variables.product.prodname_spark_short %} app from the command line.' |
| 5 | +allowTitleToDifferFromFilename: true |
| 6 | +topics: |
| 7 | + - Copilot |
| 8 | + - CLI |
| 9 | +versions: |
| 10 | + feature: spark |
| 11 | +product: '{% data variables.copilot.copilot_pro_plus_short %}, {% data variables.copilot.copilot_enterprise_short %}' |
| 12 | +contentType: tutorials |
| 13 | +--- |
| 14 | + |
| 15 | +## Introduction |
| 16 | + |
| 17 | +If you’re developing your spark further in a {% data variables.product.github %} codespace, you can deploy it directly from the command line using the {% data variables.product.prodname_spark_short %} CLI, an extension of the {% data variables.product.prodname_cli %}. |
| 18 | + |
| 19 | +### Prerequisites |
| 20 | + |
| 21 | +* **Access to {% data variables.product.prodname_copilot %}**. You need a {% data variables.copilot.copilot_pro_plus_short %} or {% data variables.copilot.copilot_enterprise_short %} license to use {% data variables.product.prodname_spark_short %}. See [AUTOTITLE](/copilot/about-github-copilot/what-is-github-copilot#getting-access-to-copilot). |
| 22 | +* You must have **built a {% data variables.product.prodname_spark_short %} app** (a "spark"). To start building, navigate to [{% data variables.product.prodname_spark_short %}](https://github.com/spark). |
| 23 | +* You have **created a repository** for your spark on {% data variables.product.github %}. For instructions, see [AUTOTITLE](/copilot/tutorials/spark/build-apps-with-spark#step-8-invite-collaborators-with-a-repository). |
| 24 | + |
| 25 | +## Open your spark in a codespace |
| 26 | + |
| 27 | +The {% data variables.product.prodname_spark_short %} CLI currently only works within a {% data variables.product.github %} codespace. |
| 28 | + |
| 29 | +1. Navigate to the main page of your spark's repository on {% data variables.product.github %}. |
| 30 | +1. Click the **{% octicon "code" aria-hidden="true" aria-label="code" %} Code** button, then click the **Codespaces** tab. |
| 31 | +1. Click **{% octicon "plus" aria-label="Create a codespace on main" %}** to create a codespace. The codespace opens in a new browser tab. |
| 32 | + |
| 33 | +## Install the {% data variables.product.prodname_spark_short %} CLI |
| 34 | + |
| 35 | +1. In the terminal in your codespace, run the following command to install the {% data variables.product.prodname_spark_short %} CLI: |
| 36 | + |
| 37 | + ```bash copy |
| 38 | + gh extensions install github/gh-runtime-cli |
| 39 | + ``` |
| 40 | + |
| 41 | +1. Once the installation is complete, to verify that the {% data variables.product.prodname_spark_short %} CLI is installed, run: |
| 42 | + |
| 43 | + ```bash copy |
| 44 | + gh runtime-cli version |
| 45 | + ``` |
| 46 | + |
| 47 | +## Build your spark |
| 48 | + |
| 49 | +1. In the terminal in your codespace, run the following command to install the latest version of the {% data variables.product.prodname_spark_short %} SDK: |
| 50 | + |
| 51 | + ```bash copy |
| 52 | + npm install @github/spark@latest |
| 53 | + ``` |
| 54 | + |
| 55 | +1. Next, run the following command to compile your {% data variables.product.prodname_spark_short %} app. |
| 56 | + |
| 57 | + ```bash copy |
| 58 | + npm run build |
| 59 | + ``` |
| 60 | + |
| 61 | +## Deploy your spark |
| 62 | + |
| 63 | +1. To deploy your {% data variables.product.prodname_spark_short %} app, run: |
| 64 | + |
| 65 | + ```bash copy |
| 66 | + gh runtime-cli deploy --dir ./dist |
| 67 | + ``` |
| 68 | + |
| 69 | +## Troubleshooting |
| 70 | + |
| 71 | +If you're being asked to supply the `--app` parameter when deploying your spark, update to the latest version of the {% data variables.product.prodname_spark_short %} SDK by following step 1 in [Build your spark](#build-your-spark). |
0 commit comments