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

feat(providers): add gitlab-pages static provider #2420

Merged
merged 4 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
43 changes: 43 additions & 0 deletions docs/2.deploy/20.providers/gitlab-pages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# GitLab Pages

> Deploy Nitro apps to GitLab Pages.

**Preset:** `gitlab_pages`

:read-more{title="GitLab Pages" to="https://pages.github.com/"}

## Setup

Follow the steps to [create a GitLab Pages site](https://docs.gitlab.com/ee/user/project/pages/#getting-started).

## Deployment

1. Here is an example GitLab Pages workflow to deploy your site to GitLab Pages:

```yaml [.gitlab-ci.yml]
# The Docker image that will be used to build your app
image: node:lts
# Functions that should be executed before the build script is run
before_script:
- npm install
pi0 marked this conversation as resolved.
Show resolved Hide resolved
pages:
cache:
paths:
# Directories that are cached between builds
- node_modules/
variables:
NITRO_PRESET: gitlab_pages
script:
# Specify the steps involved to build your app here
- npm run build
artifacts:
paths:
# The directory that contains the built files to be published
- .output/public
# The directory that contains the built files to be published
publish: .output/public
rules:
# This ensures that only pushes to the default branch
# will trigger a pages deploy
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
```
12 changes: 12 additions & 0 deletions src/presets/gitlab-pages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineNitroPreset } from "../preset";

export const gitlabPages = defineNitroPreset({
extends: "static",
prerender: {
routes: [
"/",
// https://docs.gitlab.com/ee/user/project/pages/introduction.html#custom-error-codes-pages
"/404.html",
],
},
});
1 change: 1 addition & 0 deletions src/presets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ export { koyeb } from "./koyeb";
export { iis, iisHandler, iisNode } from "./iis";
export { _static as static } from "./static";
export { githubPages } from "./github-pages";
export { gitlabPages } from "./gitlab-pages";
export { winterjs } from "./winterjs";
export { zeabur, zeaburStatic } from "./zeabur";