Skip to content

Commit dff0be0

Browse files
committed
docs: describe the setup for a deployment workflow
Ref. #2
1 parent 5e18664 commit dff0be0

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

README.md

+31-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Make sure all dependencies have been installed:
4343
Set up Contentful:
4444

4545
- Create a new and preferably empty space.
46-
- Generate API Keys for content delivery and preview tokens.
46+
- Go to *"Settings > API keys"* and add an API key for content delivery and preview tokens.
4747
- Log in to your account by running `npx contentful-cli login`.
4848

4949
## Getting started
@@ -68,6 +68,36 @@ After that, you can try out the new app. To do so, change to the newly created d
6868
you selected. You can also start the Hugo development server by running `npm start`. However,
6969
you will only see an empty page because no entries have been created in Contentful yet.
7070

71+
Nice job so far. Now you can easily deploy your site to Netlify.
72+
73+
First, push the app to GitHub:
74+
75+
```
76+
# Replace the origin with the correct URL to your repo
77+
git remote add origin [email protected]:{ACCOUNT}/{REPO}.git`
78+
git branch -M main
79+
git push -u origin main
80+
```
81+
82+
Create and configure a continuous deployment for a new site in Netlify:
83+
84+
- Log in to your account by running `npx netlify login`.
85+
- `npx netlify init` configures a continuous deployment for a new site.
86+
- And `npx netlify env:import .env` imports the current environment variables.
87+
88+
And last but not least we set up a webhook in Contentful:
89+
90+
- Netlify: Go to *"Site settings > Build & deploy > Build hooks"*, add a new build hook and copy it.
91+
- Contentful: Go to *"Settings > Webhooks"*, add a new webhook and change the following settings.
92+
- URL: Paste the copied Netlify build hook URL
93+
- Triggers: Select specific triggering events
94+
- Content Events: Select only *Publish* and *Unpublish* for *Entry*
95+
- Filter: Add a new filter *Entity ID (sys.id) equals* with *deploy-to-production*
96+
97+
You are now ready to deploy. Open the *"Deploy to production"* content entry and click *Deploy*.
98+
Switch to Netlify and check whether the webhook has run in. The build should now start
99+
and after a short while... **Site is live ✨**
100+
71101
## Get involved
72102

73103
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?maxAge=31557600)](http://makeapullrequest.com)

0 commit comments

Comments
 (0)