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: userguide/content/en/docs/deployment/_index.md
+26-26Lines changed: 26 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,41 +86,41 @@ Make sure to correctly set your site's `baseURL`, either via hugo's `--baseURL '
86
86
{{% /alert %}}
87
87
88
88
1. With GitHub Pages, a site is published to the branch `gh-pages` and served from there by default. You must create this branch first, either in the GitHub web interface or via command line (at the root of your local repo clone):
89
-
89
+
90
90
```console
91
91
$ git checkout -b gh-pages
92
92
Switched to a new branch 'gh-pages'
93
93
```
94
-
94
+
95
95
1. Push this local branch to your repo:
96
-
96
+
97
97
```console
98
98
$ git push --set-upstream origin gh-pages
99
99
details omitted …
100
100
* [new branch] new -> new
101
101
branch 'gh-pages' set up to track 'origin/gh-pages'.
102
102
```
103
-
103
+
104
104
1. Switch back to the `main` (or `work`) branch of your repo:
105
-
105
+
106
106
```console
107
107
$ git checkout main
108
108
Switched to branch 'main'
109
-
109
+
110
110
```
111
-
111
+
112
112
1. Check if you already have the workflow file `.github/workflows/deploy-github-pages.yml` in your repo. If this file doesn't exist, do the following:
113
113
114
114
1. Create a new empty workflow file from the root of your repo, as follows:
115
-
115
+
116
116
```console
117
117
$ mkdir -p .github/workflows
118
118
$ touch .github/workflows/deploy-github-pages.yml
119
119
```
120
120
121
-
121
+
122
122
1. Open the file in an editor of your choice, paste in the code below, and save the file:
123
-
123
+
124
124
```yaml
125
125
name: Deployment to GitHub Pages
126
126
@@ -144,46 +144,46 @@ Make sure to correctly set your site's `baseURL`, either via hugo's `--baseURL '
144
144
- uses: actions/checkout@v3
145
145
with:
146
146
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
147
-
147
+
148
148
- name: Setup Hugo
149
149
uses: peaceiris/actions-hugo@v2
150
150
with:
151
-
hugo-version: '0.110.0'
151
+
hugo-version: '0.120.4'
152
152
extended: true
153
-
153
+
154
154
- name: Setup Node
155
-
uses: actions/setup-node@v3
155
+
uses: actions/setup-node@v4
156
156
with:
157
-
node-version: '18'
157
+
node-version: '20'
158
158
cache: 'npm'
159
159
cache-dependency-path: '**/package-lock.json'
160
-
160
+
161
161
- run: npm ci
162
162
- run: hugo --baseURL https://${REPO_OWNER}.github.io/${REPO_NAME} --minify
163
-
163
+
164
164
- name: Deploy
165
165
uses: peaceiris/actions-gh-pages@v3
166
166
if: ${{ github.ref == 'refs/heads/main' }} # <-- specify same branch as above here
167
167
with:
168
168
github_token: ${{ secrets.GITHUB_TOKEN }}
169
169
```
170
-
170
+
171
171
1. Add the file to the staging area, commit your change and push the change to your remote GitHub repo:
$ git commit -m "Adding workflow file for site deployment"
176
-
$ git push origin
176
+
$ git push origin
177
177
```
178
-
178
+
179
179
1. In your browser, make sure you are logged into your GitHub account. In your repo **Settings**, select **Pages**.
180
-
180
+
181
181
1. Under **Build and deployment**, select **Deploy from a branch** in the **source** dropdown.
182
-
182
+
183
183
2. From the **branch** dropdown, select **gh-page** as branch where the site is built from.
184
-
184
+
185
185
3. From the **folder** dropdown, select **/(root)** as root directory.
186
-
186
+
187
187
That's it! Your deployment workflow for your site is configured.
188
188
189
189
Any future push to the branch specified in your workflow file will now trigger the action workflow defined in the workflow file. Additionally, you can trigger the deployment manually by using GitHub web UI.
@@ -194,7 +194,7 @@ Once you push to your repo, you can see the progress of the triggered workflow i
After the first successful deployment, a new environment `github-pages` is added to your repo. This is shown at the right of your repo main view (below **Releases** and **Packages**). When you click on this environment, a list of deployments is displayed:
197
+
After the first successful deployment, a new environment `github-pages` is added to your repo. This is shown at the right of your repo main view (below **Releases** and **Packages**). When you click on this environment, a list of deployments is displayed:
0 commit comments