#
GitLab Pages
Add a simple CI/CD pipeline to the project to automate the building and deployment of the Retype powered website via Gitlab Pages.
#
Summary
- Add a .gitlab-ci.yml file to your repository
- Optional Add a key to the ENV variables
- Commit a change to the repo to publish the website
#
.gitlab-ci.yml
Add the following .gitlab-ci.yml file to the project within the root folder.
image: node:latest
before_script:
- npm install retypeapp --global
stages:
- deploy
pages:
stage: deploy
script:
- retype build --key $RETYPE_KEY --output public
artifacts:
paths:
- public/
only:
- main
Gitlab will use the latest available node image from the Gitlab Registry and Download & install the latest version of the retypeapp via npm.
image: node:latest
before_script:
- npm install retypeapp --global
GitLab Pages will publish your website every time the deploy stage is triggered by a new commit to the repository.
The --key $RETYPE_KEY is optional.
The only: main argument is to ensure the rebuild is only triggered if commit new code is commited to the main branch.
pages:
stage: deploy
script:
- retype build --key $RETYPE_KEY --output public
artifacts:
paths:
- public/
only:
- main
Commit the .gitlab-ci.yml file and push to the repo.
#
RETYPE_KEY
If using Retype Pro, the project requires a Retype key. The key can be configured by adding the RETYPE_KEY Environment variable to the repository using the following URL location:
# Replace [username] and [project] with your values
https://gitlab.com/[username]/[project]/-/settings/ci_cd
The variable type must be standard, plus it is recommended to mask and protect the variable.
After the pipeline finishes successfully, your new generated website will be available online at the following location:
# Replace [username] and [project] with your values
https://[username].gitlab.io/[project]/