CI/CD with .vpsm.yml and previews
A pipeline runs steps such as tests, checks and approvals before a deploy. Steps run on your own server in containers. Without a pipeline, a push deploys straight away.
Turn on a pipeline
- Open the project and find the Pipeline card. It starts as off (pushes deploy directly).
- Paste or edit the YAML in Pipeline YAML, click Validate, then Turn on pipeline.
From then on, pushes to the project's branch start a pipeline run instead of a direct deploy. If your repository has a .vpsm.yml file at its root, the file from that commit is used instead of the YAML saved in the dashboard. The pipeline still has to be turned on in the dashboard for the file to be used.
Runs report a vpsm/pipeline commit status on GitHub, and pull request runs post a summary comment. From the card you can Run now, Cancel, Retry, and Approve or Reject waiting steps. Each step's log can be expanded.
Example
version: 1
on:
push: { branches: [main] }
pull_request: {}
pipeline:
- name: test
image: node:24-alpine
cache: [node_modules]
run:
- corepack enable && pnpm i --frozen-lockfile
- pnpm test
- name: deploy
type: deploy
environment: "${{ event == 'pull_request' && 'preview' || 'production' }}"File reference
Unknown keys are errors, so typos are caught by Validate. The file can be up to 64 KB.
| Key | Meaning |
|---|---|
version | Required. Always 1. |
on | When to run: push (with branches, tags), pull_request (with branches), schedule (a list of cron entries, UTC, up to 10) and manual: true. Defaults to push. |
concurrency | cancel-in-progress (default) cancels an older run when a new one starts; queue runs them one after another. |
pipeline | The list of steps, 1 to 50, with unique names. |
Every step has a name (lowercase letters, digits, - and _) and an optional when, either { branch, event } or a ${{ }} expression. There are four step types:
| Type | Keys |
|---|---|
run (the default) | image, run (a command or a list), workdir, env, secrets, cache (relative paths kept between runs), timeout (minutes, 1 to 180, default 20) |
github_checks | require: names of GitHub checks that must pass; timeout (default 60) |
approval | approvers: { role: admin } (owner, admin, developer or operator; default admin); timeout (default 1440 minutes) |
deploy | environment: production, or preview for pull request runs |
secrets lists the names of project environment variables a step may read. Steps get no project variables otherwise.
Current limitations
- Runs are started by pushes to the project's branch (with Deploy on push on) and by pull requests into it (with previews on). The
onsection then decides whether a run goes ahead: a push must matchon.push.branches(if given), and pull request runs only happen whenon.pull_requestis present (the default is push only). A run that doesn't match ends right away without steps or a GitHub status. - Schedules are read from the YAML saved in the dashboard, not from the repository file.
Pull request previews
A preview is a temporary copy of your app for each pull request.
- Add and verify a domain for previews, for example
preview.example.com(see Custom domains). - Create a wildcard A record,
*.preview.example.com, pointing at the server. - In the project's Pull request previews card, tick Enabled, enter the Preview base domain and click Save.
When a pull request into the project's branch is opened, reopened or updated, a preview is deployed at:
pr-<number>-<project slug>.preview.example.comTLS is set up automatically and the link is posted on the pull request. The preview is removed when the pull request closes.
- At most 5 previews run at once. Older ones, and ones idle for 7 days, are paused (Paused (push to resume)).
- Previews get no environment variables unless you tick Share environment variables with previews.
- Pull requests from forks never get a preview. With a pipeline on, a fork's run waits for approval and gets no secrets.
Cron jobs
The Cron jobs card runs commands on a schedule inside the live image, with the project's environment variables. Enter a name, a cron schedule in UTC (for example 0 3 * * *) and a command, then click Add. Each job can be run now, paused, resumed or deleted, and shows its last run. If the project has no live deployment, the run is skipped.