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

docs: Create gitlab-continuous-integration.md #23367

Merged
merged 10 commits into from
Apr 22, 2020
53 changes: 53 additions & 0 deletions docs/docs/recipes/gitlab-continuous-integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: "Recipes: Continuous Integration on Gitlab"
tableOfContentsDepth: 1
---

Push your code to gitlab and automate your production build!
Ekwuno marked this conversation as resolved.
Show resolved Hide resolved

### Prerequisites

- Make sure you have the [Gatsby CLI](https://www.gatsbyjs.org/docs/gatsby-cli) installed
puzzledbytheweb marked this conversation as resolved.
Show resolved Hide resolved
- A [Gitlab](https://gitlab.com/) account

### Directions
1. Create a gatsby site
```shell
gatsby new {your-project-name}
```
2. Change directory and start a development server
```shell
cd {your-project-name}
yarn develop
```

3. Stop your development server (`Ctrl + C` on your command line in most cases)

4. Create a `.gitlab-ci.yml` with the following content:

```
image: node:12.16.1

cache:
paths:
- node_modules/

stages:
- build

build:
stage: build
script:
- yarn
- yarn build
puzzledbytheweb marked this conversation as resolved.
Show resolved Hide resolved
```

3. `git push <you-remote-gitlab-repo>`
4. Check out your pipeline under the CI/CD option.

### Additional resources

- See how you can develop this simple file into something more real world [Gitlab CI/CD Docs](https://docs.gitlab.com/ee/ci/README.html)
- Check this especially to learn how to make your newly build available for a next job - [Gitlab Job Artifacts Docs](https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html)
puzzledbytheweb marked this conversation as resolved.
Show resolved Hide resolved

- [Getting started with GitLab CI/CD](https://gitlab.com/help/ci/quick_start/README)