Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add Gitlab Pages deployment example
Co-authored-by: razonyang <razonyang@gmail.com>
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
+++ | ||
# type = "docs" | ||
title = "Deploy to GitLab Pages" | ||
linkTitle = "GitLab Pages" | ||
date = 2022-08-27T10:30:23+08:00 | ||
# description = "" # Used by description meta tag, summary will be used instead if not set or empty. | ||
featured = false | ||
draft = false | ||
comment = true | ||
toc = true | ||
reward = true | ||
pinned = false | ||
carousel = false | ||
categories = ["Deployment"] | ||
tags = ["GitLab Pages", "GitLab CI"] | ||
series = ["Docs"] | ||
images = [] | ||
+++ | ||
|
||
This article explains how to deploy sites to [GitLab Pages](https://docs.gitlab.com/ee/user/project/pages/) using GitLab CI. | ||
|
||
<!--more--> | ||
|
||
## Workflow | ||
|
||
Create `.gitlab-ci.yml` at the root of your site with the following contents: | ||
|
||
```yaml | ||
{{% code/deployment-gitlab-pages-ci %}} | ||
``` | ||
|
||
> See also [Starter Template GitLab Pages Configuration](https://github.com/razonyang/hugo-theme-bootstrap-skeleton/blob/main/.gitlab-ci.yml)。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
exampleSite/layouts/shortcodes/code/deployment-gitlab-pages-ci.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
image: registry.gitlab.com/pages/hugo/hugo_extended:latest | ||
|
||
variables: | ||
HUGO_ENV: production | ||
|
||
default: | ||
before_script: | ||
- apk add --update --no-cache git go npm | ||
- npm install | ||
- hugo mod get -u | ||
|
||
test: | ||
script: | ||
- hugo --gc --minify | ||
|
||
pages: | ||
script: | ||
- hugo --gc --minify | ||
artifacts: | ||
paths: | ||
- public |