Deployments
Sveltia CMS is a headless CMS, so it doesn’t involve any specific deployment process. You can deploy your project like any other web application by using your preferred hosting service or platform.
CI/CD Integration
In most cases, you may want to automatically deploy your website whenever content is saved in your Git repository via Sveltia CMS. This can be achieved by integrating with a CI/CD (Continuous Integration/Continuous Deployment) service that monitors your Git repository for changes and triggers a build and deployment process.
All the supported Git backends offer their own CI/CD solutions or can be easily integrated with popular third-party CI/CD services. Here are some examples:
- Building: GitHub Actions, GitLab CI/CD, Gitea Actions, Forgejo Actions, Cloudflare Pages, Netlify, Vercel, CircleCI, Travis CI, Jenkins, etc.
- Hosting: GitHub Pages, GitLab Pages, Cloudflare Pages, Netlify, Vercel, Amazon EC2, Firebase Hosting, DigitalOcean Droplets, etc.
Your choice of CI/CD service may depend on factors such as ease of use, pricing, performance, and integration with your existing workflow. Some services only host completely static sites, while others can handle dynamic applications as well. Refer to the documentation of your chosen CI/CD and hosting providers for specific instructions on how to set up the deployment process.
Disabling Automatic Deployments
You may already have a CI/CD tool set up on your Git repository to automatically deploy changes to production. Occasionally, you make a lot of changes to your content to quickly reach the CI/CD provider’s (free) build limits, or you just don’t want to see builds triggered for every single small change.
With Sveltia CMS, you can disable automatic deployments by default and manually trigger deployments at your convenience. This is done by adding the [skip ci] prefix to commit messages, the convention supported by GitHub Actions, GitLab CI/CD, CircleCI, Travis CI, Netlify, Cloudflare Pages and others.
Configuration
Here are the steps to use this feature:
Add the
skip_ciproperty to yourbackendconfiguration with a value oftrue:yamlbackend: name: github repo: owner/repo branch: main skip_ci: truetoml[backend] name = "github" repo = "owner/repo" branch = "main" skip_ci = truejson{ "backend": { "name": "github", "repo": "owner/repo", "branch": "main", "skip_ci": true } }js{ backend: { name: "github", repo: "owner/repo", branch: "main", skip_ci: true, }, }Commit and deploy the change to the config file and reload the CMS.
Now, whenever you save an entry or asset,
[skip ci]is automatically added to each commit message. However, deletions are always committed without the prefix to avoid unexpected data retention on your site.If you want to deploy a new or updated entry, as well as any other unpublished entries and assets, click an arrow next to the Save button in the Content Editor, then select Save and Publish. This will trigger CI/CD by omitting
[skip ci].
If you set skip_ci to false, the behavior is reversed. CI/CD will be triggered by default, while you have an option to Save without Publishing that adds [skip ci] only to the associated commit.
Deprecation Notice
The automatic_deployments option has been deprecated in favor of the more intuitive skip_ci option and will be removed in Sveltia CMS v1.0.0. If you are upgrading from an older version, update your configuration accordingly: automatic_deployments: false is equivalent to skip_ci: true, while automatic_deployments: true is equivalent to skip_ci: false.
Unpublished vs. Drafts
Unpublished entries and assets are not drafts. Once committed to your repository, those changes can be deployed any time another commit is pushed without [skip ci], or when a manual deployment is triggered.
Manual Deployment Trigger
If the skip_ci property is defined, you can manually trigger a deployment by clicking the Publish Changes button on the application header. To use this feature:
GitHub Actions
Without any configuration, Publish Changes will trigger a repository_dispatch event with the sveltia-cms-publish event type. Update your build workflow to receive this event:
on:
push:
branches: [$default-branch]
repository_dispatch:
types: [sveltia-cms-publish]Other CI/CD Providers
To use Publish Changes with a CI/CD provider other than GitHub Actions, you need to set up a webhook in your CI/CD provider that triggers a build when called. Check your provider’s documentation for instructions on how to create a deploy hook URL. Here are some examples:
Then, configure Sveltia CMS to use this URL:
- Select Settings under the Account button in the top right corner of the CMS.
- Select the Advanced tab.
- Enter the deploy hook URL for your provider.
- Configure the CSP if necessary.
Why Deploy Hook URL Is Stored in User Settings
Deploy hook URLs are confidential and cannot be stored in the CMS configuration file, which is typically accessible via a public website. As Sveltia CMS works entirely in the frontend, there is no secure place to store such credentials. This is why they are managed in the user settings, which are stored securely in the browser’s local storage.
In the future, we may provide a way to manage credentials for all users via an edge function called Sveltia CMS Additions.