From e714066cb2448828111068c847e48e8590e37edd Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sun, 20 Feb 2022 16:44:09 -0800 Subject: [PATCH] Update GitLab deployment instructions (#1661) --- .../hosting-on-gitlab.md | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/content/en/hosting-and-deployment/hosting-on-gitlab.md b/content/en/hosting-and-deployment/hosting-on-gitlab.md index e15cd4c27..03c7776a7 100644 --- a/content/en/hosting-and-deployment/hosting-on-gitlab.md +++ b/content/en/hosting-and-deployment/hosting-on-gitlab.md @@ -1,7 +1,7 @@ --- title: Host on GitLab linktitle: Host on GitLab -description: GitLab makes it incredibly easy to build, deploy, and host your Hugo website via their free GitLab Pages service, which provides native support for Hugo. +description: GitLab makes it easy to build, deploy, and host your Hugo website via their free GitLab Pages service, which provides native support for Hugo. date: 2016-06-23 publishdate: 2016-06-23 lastmod: 2017-11-16 @@ -20,25 +20,23 @@ wip: false aliases: [/tutorials/hosting-on-gitlab/] --- -[GitLab](https://gitlab.com/) makes it incredibly easy to build, deploy, and host your Hugo website via their free GitLab Pages service, which provides [native support for Hugo, as well as numerous other static site generators](https://gitlab.com/pages/hugo). - ## Assumptions * Working familiarity with Git for version control -* Completion of the Hugo [Quick Start][] +* Completion of the Hugo [Quick Start] * A [GitLab account](https://gitlab.com/users/sign_in) * A Hugo website on your local machine that you are ready to publish -## Create .gitlab-ci.yml +## BaseURL -``` -cd your-hugo-site -``` +The `baseURL` in your [site configuration](/getting-started/configuration/) must reflect the full URL of your GitLab pages repository if you are using the default GitLab Pages URL (e.g., `https://.gitlab.io//`) and not a custom domain. -In the root directory of your Hugo site, create a `.gitlab-ci.yml` file. The `.gitlab-ci.yml` configures the GitLab CI on how to build your page. Simply add the content below. +## Configure GitLab CI/CD + +Define your [CI/CD](https://docs.gitlab.com/ee/ci/quick_start/) jobs by creating a `.gitlab-ci.yml` file in the root of your project. {{< code file=".gitlab-ci.yml" >}} -image: registry.gitlab.com/pages/hugo:latest +image: registry.gitlab.com/pages/hugo/hugo_extended:latest variables: GIT_SUBMODULE_STRATEGY: recursive @@ -54,14 +52,14 @@ pages: {{< /code >}} {{% note %}} -All available Hugo versions are listed [here](https://gitlab.com/pages/hugo/container_registry) +See [this list](https://gitlab.com/pages/hugo/container_registry) if you wish to use a particular Hugo version to build your site. {{% /note %}} ## Push Your Hugo Website to GitLab Next, create a new repository on GitLab. It is *not* necessary to make the repository public. In addition, you might want to add `/public` to your .gitignore file, as there is no need to push compiled assets to GitLab or keep your output website in version control. -``` +```bash # initialize new git repository git init @@ -81,10 +79,6 @@ That's it! You can now follow the CI agent building your page at `https://gitlab After the build has passed, your new website is available at `https://.gitlab.io//`. -{{% note %}} -Make sure your `baseURL` key-value in your [site configuration](/getting-started/configuration/) reflects the full URL of your GitLab pages repository if you're using the default GitLab Pages URL (e.g., `https://.gitlab.io//`) and not a custom domain. -{{% /note %}} - ## Next Steps GitLab supports using custom CNAME's and TLS certificates. For more details on GitLab Pages, see the [GitLab Pages setup documentation](https://about.gitlab.com/2016/04/07/gitlab-pages-setup/).