[Sable](https://github.com/7w1/sable/) is a new Matrix client based on Cinny, and offering some enhancements. It is currently offered as a client on the [[Matrix]] service.
This page describes how to deploy it on GitLab pages. A [demo repository](https://g.j4.lc/general-stuff/cicd/sable) is also available.
### Tutorial
#### Preparations
It is recommended to first create a mirror of the repository somewhere on the instance. For instance, [[PurpleLabs GitLab]] has the `Backups` group for that. Once the repository is mirrored, you can fork it under either your own user, or a proper group.
The point of using a fork is that once the CI/CD is in place, you will just have to hit "Update fork" to update the app and deploy it.
#### Setting up the builds
You will need to create a few files in the root of the repository:
```bash
~ cp config.json server-config.json
~ touch .gitlab-ci.yml
```
Once those two files created, you can edit `config.json` and change the following:
- Set the `enabled` property of `hashRouter` to `true` as it will avoid 404s when reloading the client.
Within `.gitlab-ci.yml`, add:
```yaml
stages:
- build
- deploy
build:
stage: build
image: node:lts-alpine
tags:
- x86
cache:
- key: npm-$CI_COMMIT_REF_NAME
paths:
- node_modules
script:
- npm ci
- npm run build
- mv config-server.json dist/config.json
artifacts:
paths:
- dist/
deploy:
stage: deploy
image: alpine
needs: ["build"]
pages:
publish: dist
before_script:
- apk add brotli
script:
- echo "Compressing for web"
- find dist -type f -regex '.*\.\(htm\|html\|xml\|txt\|text\|js\|css\|svg\)