Skip to content

Commit

Permalink
guides: update gitlab (#5130)
Browse files Browse the repository at this point in the history
Co-authored-by: Sarah Rainsberger <[email protected]>
  • Loading branch information
dreyfus92 and sarah11918 authored Nov 5, 2023
1 parent 7997d97 commit 161226d
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions src/content/docs/en/guides/deploy/gitlab.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand All @@ -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://<user>.gitlab.io',
base: '/<project-name>'
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
```

0 comments on commit 161226d

Please sign in to comment.