Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

guides: update gitlab #5130

Merged
merged 2 commits into from
Nov 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
```
Loading