From 6cb89c9440e89569dd97d760dde4d1edab76c3db Mon Sep 17 00:00:00 2001 From: "Wilson E. Alvarez" Date: Sat, 27 Aug 2022 16:12:28 -0400 Subject: [PATCH] docs: add Gitlab Pages deployment example Co-authored-by: razonyang --- .../docs/deployment/gitlab-pages/index.md | 32 +++++++++++++++++++ .../content/docs/deployment/overview/index.md | 1 + .../code/deployment-gitlab-pages-ci.html | 21 ++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 exampleSite/content/docs/deployment/gitlab-pages/index.md create mode 100644 exampleSite/layouts/shortcodes/code/deployment-gitlab-pages-ci.html diff --git a/exampleSite/content/docs/deployment/gitlab-pages/index.md b/exampleSite/content/docs/deployment/gitlab-pages/index.md new file mode 100644 index 000000000..e69c528f9 --- /dev/null +++ b/exampleSite/content/docs/deployment/gitlab-pages/index.md @@ -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. + + + +## 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)。 diff --git a/exampleSite/content/docs/deployment/overview/index.md b/exampleSite/content/docs/deployment/overview/index.md index 59b3ae72d..83d5e577d 100644 --- a/exampleSite/content/docs/deployment/overview/index.md +++ b/exampleSite/content/docs/deployment/overview/index.md @@ -62,6 +62,7 @@ This step depends on the which deployment methods you use. 1. [GitHub Pages]({{< ref "docs/deployment/github-pages" >}}) 1. [Netlify]({{< ref "docs/deployment/netlify" >}}) 1. [Cloudflare Pages]({{< ref "docs/deployment/cloudflare-pages" >}}) +1. [GitLab Pages]({{< ref "docs/deployment/gitlab-pages" >}}) 1. Find more on [Hosting & Deployment](https://gohugo.io/hosting-and-deployment/) ## Further Reading diff --git a/exampleSite/layouts/shortcodes/code/deployment-gitlab-pages-ci.html b/exampleSite/layouts/shortcodes/code/deployment-gitlab-pages-ci.html new file mode 100644 index 000000000..e2e1ab507 --- /dev/null +++ b/exampleSite/layouts/shortcodes/code/deployment-gitlab-pages-ci.html @@ -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