Topics Map > Engineering Digital Service > Services > GitLab
GitLab Tutorials – Learn how to use GitLab CI
Setting Up GitLab CI Pipeline for GitLab Pages
GitLab Pages is available to all users on code.umd.edu and allows you to publish static websites directly to pages.umd.edu from your GitLab repository.
Table of Contents
- Setting Up GitLab CI Pipeline for GitLab Pages
- Table of Contents
- Overview
- Prerequisites
- Step 1: Create a .gitlab-ci.yml File
- Step 2: Adjust for Specific Static Site Generators
- Step 3: Commit and Push Your CI Configuration
- Step 4: Monitor the Pipeline
- Step 5: Access Your Published Website
- Troubleshooting
- Example: Complete CI Configuration with Caching
- Where Can I Find More Documentation?
- Where Can I Get Support?
Overview
GitLab Pages allows you to publish static websites directly from your GitLab repository. This guide walks you through setting up a basic CI/CD pipeline to automatically build and deploy your static website to GitLab Pages whenever you push changes to your repository.
Prerequisites
- A GitLab account on code.umd.edu
- A GitLab repository containing your static website files
- Basic familiarity with Git and GitLab
Step 1: Create a .gitlab-ci.yml
File
At the root of your repository, create a file named .gitlab-ci.yml
. This file defines how GitLab CI will build and deploy your website. For a basic HTML/CSS/JavaScript website, use this configuration:
This configuration:
- Creates a job named
pages
in thedeploy
stage - Copies all files to a
public
directory - Publishes the
public
directory as an artifact - Only runs when changes are pushed to the
main
branch
Step 2: Adjust for Specific Static Site Generators
For Jekyll:
For Hugo:
For React (create-react-app):
Step 3: Commit and Push Your CI Configuration
After creating the .gitlab-ci.yml
file:
Step 4: Monitor the Pipeline
- Go to your GitLab repository
- Navigate to CI/CD > Pipelines
- You should see your pipeline running
- Wait for it to complete successfully
Step 5: Access Your Published Website
Once the pipeline completes successfully:
- Go to Settings > Pages in your GitLab repository
- Find the URL to your published website (typically
https://[username].pages.umd.edu/[repository-name]
) - Note: It may take a few minutes for the site to become available after the first deployment
Troubleshooting
Pipeline Fails
If your pipeline fails:
- Check the job logs for specific error messages
- Verify that your
.gitlab-ci.yml
syntax is correct - Ensure your project structure is compatible with the configured build process
Custom Domain
To use a custom domain:
- Go to Settings > Pages
- Add your custom domain
- Follow the verification instructions
Performance Optimization
For better performance:
- Use GitLab CI caching to speed up builds
- Optimize your asset files (images, CSS, JS)
- Consider using a CDN for additional speed
Example: Complete CI Configuration with Caching
Where Can I Find More Documentation?
Where Can I Get Support?
Open a support request with the Engineering Digital Service team using this form.