Skip to content

Commit 1da821b

Browse files
authored
1 parent 7ef2a34 commit 1da821b

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

web/docs/advanced/deployment/manually.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,89 @@ netlify deploy --prod
265265

266266
That is it! Your client should be live at `https://<app-name>.netlify.app`
267267

268+
:::caution
269+
Please do not set up the continuous deploy through the Netlify website. When deployed in this way, Netlify doesn't redirect URLs toward `index.html` but instead returns 404, which can break the user authentication functionality. Wasp by default comes with a `netlify.toml` file in `.wasp/build/web-app` that configures Netfliy correctly, but the configuration may break when deployed through the Netlify website.
270+
271+
It is recommended to deploy through the Netlify CLI in Github Actions. The first deploy can be through the website or manually through get a `NETLIFY_SITE_ID`, then the following deploys can be automatic.
272+
273+
<details>
274+
<summary>Example Github Action (Updated for 0.15.0)</summary>
275+
276+
```
277+
name: Deploy Client to Netlify
278+
279+
on:
280+
push:
281+
branches:
282+
- main # Deploy on every push to the main branch
283+
284+
jobs:
285+
deploy:
286+
runs-on: ubuntu-latest
287+
288+
steps:
289+
- name: Checkout Code
290+
uses: actions/checkout@v2
291+
292+
- name: Setup Node.js
293+
id: setup-node
294+
uses: actions/setup-node@v4
295+
with:
296+
node-version: '20'
297+
298+
- name: Docker setup
299+
uses: docker/setup-buildx-action@v3
300+
301+
- name: Install Wasp
302+
run: curl -sSL https://get.wasp-lang.dev/installer.sh | sh -s -- -v 0.15.0 # Change to your Wasp version
303+
304+
- name: Wasp Build
305+
run: cd ./app && wasp build
306+
307+
- name: Install dependencies and build Vite project
308+
run: |
309+
cd ./app/.wasp/build/web-app
310+
npm install
311+
REACT_APP_API_URL=${{ secrets.WASP_SERVER_URL }} npm run build
312+
313+
- name: Deploy to Netlify
314+
run: |
315+
cd ./app/.wasp/build/web-app
316+
npm install -g netlify-cli
317+
netlify deploy --prod --dir=build --auth=$NETLIFY_AUTH_TOKEN --site=$NETLIFY_SITE_ID
318+
319+
env:
320+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
321+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
322+
```
323+
</details>
324+
325+
<details>
326+
<summary>How do I get the Environment Variables?</summary>
327+
328+
- **`NETLIFY_AUTH_TOKEN`**: This is the token that allows GitHub Actions to authenticate with your Netlify account. You can generate this from the **Netlify User Settings**:
329+
- Go to your [Netlify User Settings Page](https://app.netlify.com/user/settings).
330+
- Scroll down to **Personal Access Tokens**.
331+
- Click on **New Access Token** to create a new token.
332+
333+
- **`NETLIFY_SITE_ID`**: This is the unique identifier for your Netlify site. You can obtain this from the **Site Settings** of your site in the Netlify dashboard:
334+
- Go to your **Netlify dashboard**.
335+
- Click on the specific site you want to deploy.
336+
- Go to **Site Settings****General****Site Information****Site ID**.
337+
338+
- **`WASP_SERVER_URL`**: This is the link that points to your backend and is generally only available after **deploying the backend**. This variable can be skipped when the backend is not functional or not deployed, but be aware that backend-dependent functionalities may be broken.
339+
340+
After obtaining the environment variables, you need to store these values securely in GitHub Secrets. To add these:
341+
342+
1. Go to your **GitHub repository**.
343+
2. Navigate to **Settings****Secrets and variables****Actions****New repository secret**.
344+
3. Add the following secrets:
345+
- `NETLIFY_AUTH_TOKEN`
346+
- `NETLIFY_SITE_ID`
347+
- `WASP_SERVER_URL`
348+
</details>
349+
:::
350+
268351
:::note
269352
Make sure you set this URL as the `WASP_WEB_CLIENT_URL` environment variable in your server hosting environment (e.g., Fly.io or Heroku).
270353
:::

0 commit comments

Comments
 (0)