You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/content/1.docs/1.getting-started/3.deploy.md
+144-46
Original file line number
Diff line number
Diff line change
@@ -43,10 +43,6 @@ Toggle between production and preview environments in the NuxtHub admin using th
43
43
44
44
## NuxtHub CLI
45
45
46
-
::important
47
-
If you do your first deployment with the NuxtHub CLI, you won't be able to attach your GitHub/GitLab repository later on due to a Cloudflare limitation, but you can use the [Github action](#github-action) to deploy on commit.
48
-
::
49
-
50
46
Deploy your local project with a single command:
51
47
52
48
```bash [Terminal]
@@ -71,76 +67,178 @@ The command will:
71
67
You can also install the [NuxtHub CLI](https://github.com/nuxt-hub/cli) globally with: `npm i -g nuxthub`.
72
68
::
73
69
74
-
### GitHub Action
70
+
## GitHub Action
71
+
72
+
After linking a GitHub repository to your project, NuxtHub automatically adds a GitHub Actions workflow to automatically deploy your application on every commit using the [NuxtHub GitHub Action](https://github.com/marketplace/actions/deploy-to-nuxthub).
73
+
74
+
NuxtHub integrates with [GitHub deployments](https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-deployments). This allows you to:
75
+
-[View deployment statuses within GitHub](https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-deployments/viewing-deployment-history)
-[Require approvals for deploying to environments](https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-deployments/reviewing-deployments)
75
78
76
-
To deploy your project with a GitHub Action, you can use the following workflow:
79
+
After deploying from a pull request, NuxtHub automatically adds a comment with information about the deployment.
80
+
81
+
:nuxt-img{src="/images/docs/nuxthub-github-app-pr-comment.png"alt="NuxtHUb GitHub Action commenting on pull requests"width="926"height="520"}
82
+
83
+
::tip
84
+
You can customise the workflow to tailor to any specific custom DevOps requirements.
Projects created prior to releasing our GitHub Action uses Pages CI for deployments. Read our [migration guide](#linking-a-repository-to-existing-projects).
89
+
::
90
+
91
+
### Default workflow
92
+
93
+
The GitHub Workflow added to your repository is automatically tailored to your project's package manager. This is an example of a workflow added for a project using pnpm.
You need to add the following secrets to your GitHub repository:
118
-
- `NUXT_HUB_PROJECT_KEY`: Your project key (available in your project settings in the NuxtHub Admin or in your `.env` file if you ran `npx nuxthub link`)
119
-
- `NUXT_HUB_USER_TOKEN`: Your user token available in **User settings** → **Tokens** in the NuxtHub Admin
137
+
### Options
120
138
121
-
::tip
122
-
We recommend to create a new user token for the Github CI so you can revoke it at any time or add an expiration date.
139
+
#### Inputs
140
+
141
+
The following input parameters can be provided to the GitHub Action. Learn more about [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswith) on GitHub's documentation.
This GitHub action uses pnpm to install dependencies. If you are using npm or yarn, we recommend you to adapt the action to your needs.
196
+
This is mostly useful for build-time environment variables.
127
197
::
128
198
129
-
## Cloudflare Pages CI
199
+
### Setup
200
+
201
+
#### Creating a new project
202
+
203
+
When creating a new project from a template, or importing a Git repository, the GitHub Action workflow will automatically be set up for you.
204
+
205
+
#### Linking a repository to existing projects
206
+
207
+
Link your project to a GitHub repository within [NuxtHub Admin](https://admin.hub.nuxt.com/) → Project → Settings → Git.
130
208
131
209
::warning
132
-
You should never create the project on Cloudflare Pages as NuxtHub will create it for you.
210
+
Only non-secret environment variables are automatically copied to GitHub. Existing environment secrets are not automatically migrated to GitHub, and should be updated to sync them to GitHub.
133
211
::
134
212
135
-
It is possible to use [Cloudflare Pages CI](https://pages.cloudflare.com) to deploy your project by connecting your GitHub or GitLab account. Once your repository is connected, each commit will trigger a new deployment.
213
+
#### Monorepo setup
136
214
137
-
1. Open the [NuxtHub Admin](https://admin.hub.nuxt.com)
138
-
2. Click on `New Project` then `Import a GitHub repository`
139
-
3. Select your Github repository
140
-
4. Click on `Import repository`
215
+
Our GitHub integration supports deploying multiple applications from the same repository.
141
216
142
-
::tip
143
-
That's it! NuxtHub will automatically configure the necessary resources and environment variables for you start a deployment on Cloudflare.
217
+
When linking a Git repository, set "project root directory" to the base folder of your Nuxt application corresponding to that NuxtHub project.
218
+
219
+
When a repository is already linked to at least one project, additional projects linked will have the generated GitHub Actions workflow named `nuxthub-<projectSlug>.yml`.
220
+
221
+
::note
222
+
When multiple projects are linked to the same repository, the [`project-key`](#inputs) input parameter must be specified on each [Deploy to NuxtHub GitHub Action](https://github.com/marketplace/actions/deploy-to-nuxthub).
223
+
::
224
+
225
+
**Current limitations**
226
+
227
+
- Separate applications should be deployed using different workflow jobs.
228
+
229
+
## Cloudflare Pages CI
230
+
231
+
Importing an existing Cloudflare Pages project that is already linked to a Git repository will use [Cloudflare Pages CI](https://pages.cloudflare.com) to deploy your project.
232
+
233
+
- Each commit will trigger a new deployment within Pages CI.
234
+
- Environment variables set within NuxtHub Admin will be available during CI.
235
+
236
+
::note
237
+
All existing projects with a Git repository linked to Cloudflare Pages prior to our GitHub Action being released uses [Cloudflare Pages CI](https://pages.cloudflare.com) for automated deployments.
238
+
::
239
+
240
+
::tip{to="#migrating-to-from-pages-ci"}
241
+
You can migrate from Cloudflare Pages CI to [GitHub Actions](#github-action) at any time. Read our [migration guide](#linking-a-repository-to-existing-projects).
We're thrilled to release our brand new [GitHub Application](https://github.com/apps/nuxthub-admin) & [GitHub Action](https://github.com/marketplace/actions/deploy-to-nuxthub) to help you create and deploy Nuxt applications to NuxtHub.
20
+
21
+
22
+
## Pull Request Integration
23
+
24
+
Once setup, NuxtHub will automatically comment on pull requests with branch URLs, permalinks and QR codes for easy preview access.
-**Deployment Protection**: Support for GitHub's deployment protection rules which enable approval workflows and environment restrictions ([learn more on GitHub's documentation](https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-deployments/managing-environments-for-deployment#deployment-protection-rules))
40
+
-**Secure**: Our GitHub integration prevents the need for long-lived secrets as it uses OIDC under the hood
41
+
-**Customizable**: You can create tailored workflows to fit your DevOps requirements using our GitHub Action
42
+
43
+
## Cloning a Template
44
+
45
+
Thanks to the new GitHub App, you can now clone a template from NuxtHub Admin and deploy it with a single click.
The repository will be created in your GitHub account with the GitHub Actions workflow already configured.
51
+
::
52
+
53
+
## Migrating to GitHub Actions
54
+
55
+
Migrating from Cloudflare Pages CI or the legacy GitHub Action is simple and can be done from [NuxtHub Admin](https://admin.hub.nuxt.com/) → Project → Settings → Git.
56
+
57
+
<!-- img of migration alert -->
58
+
59
+
When migrating from Cloudflare Pages CI, please note:
60
+
61
+
- Deployment quotas will shift from [Pages CI limits](https://developers.cloudflare.com/pages/platform/limits/#builds) to your [GitHub Actions usage](https://docs.github.com/en/billing/managing-billing-for-your-products/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes)
62
+
- Environment variables and secrets needed at build time should be managed through [GitHub Environment settings](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#creating-configuration-variables-for-an-environment) (we are working on a way to synchronize them automatically)
0 commit comments