From ceb870d8354d70823deffa67a19e970137ba3167 Mon Sep 17 00:00:00 2001 From: Paul Valladares <85648028+dreyfus92@users.noreply.github.com> Date: Tue, 17 Oct 2023 23:19:45 -0600 Subject: [PATCH] update: update gitlab --- src/content/docs/en/guides/deploy/gitlab.mdx | 46 ++++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/content/docs/en/guides/deploy/gitlab.mdx b/src/content/docs/en/guides/deploy/gitlab.mdx index 607dca2b06260..4a6ed0193cd78 100644 --- a/src/content/docs/en/guides/deploy/gitlab.mdx +++ b/src/content/docs/en/guides/deploy/gitlab.mdx @@ -14,7 +14,8 @@ Check out [the official GitLab Pages Astro example project](https://gitlab.com/p ## How to deploy 1. Set the correct `site` in `astro.config.mjs`. -2. Set `outDir:public` in `astro.config.mjs`. This setting instructs Astro to put the static build output in a folder called `public`, which is the folder required by GitLab Pages for exposed files. +2. Rename the `public/` directory to `static`. +3. Set `outDir:public` in `astro.config.mjs`. This setting instructs Astro to put the static build output in a folder called `public`, which is the folder required by GitLab Pages for exposed files. If you were using the [`public/` directory](/en/core-concepts/project-structure/#public) as a source of static files in your Astro project, rename it and use that new folder name in `astro.config.mjs` for the value of `publicDir`. @@ -24,36 +25,35 @@ Check out [the official GitLab Pages Astro example project](https://gitlab.com/p import { defineConfig } from 'astro/config'; export default defineConfig({ - sitemap: true, - site: 'https://astro.build/', + site: 'https://.gitlab.io', + base: '/' outDir: 'public', publicDir: 'static', }); ``` -3. Create a file called `.gitlab-ci.yml` in the root of your project with the content below. This will build and deploy your site whenever you make changes to your content: +4. Create a file called `.gitlab-ci.yml` in the root of your project with the content below. This will build and deploy your site whenever you make changes to your content: ```yaml # The Docker image that will be used to build your app image: node:lts - pages: - cache: - paths: - - node_modules/ - script: - # Specify the steps involved to build your app here - - npm install - - npm run build - - artifacts: - paths: - # The folder that contains the built files to be published. - # This must be called "public". - - public - - only: - # Trigger a new build and deploy only when there is a push to the - # branch(es) below - - main + before_script: + - npm ci + + pages: + script: + # Specify the steps involved to build your app here + - npm run build + + artifacts: + paths: + # The folder that contains the built files to be published. + # This must be called "public". + - public + + only: + # Trigger a new build and deploy only when there is a push to the + # branch(es) below + - main ```