
This GitHub Action publishes your site on your MozOut VPS. It asks our API which server to use and what its IP is, checks that it is running, and copies the files with rsync over SSH.
What it does
With a single active VPS on the account, it uses that one. With several, you choose one with server-id (the id of its service) or server-name (its hostname or IP).
If the VPS is starting or restarting, the action waits. A suspended VPS stops the deploy with a clear message. With start-if-stopped, a stopped VPS is started through the API.
The copy takes exclude (paths to leave out), delete (delete files on the VPS that are not in source), dry-run and commands run on the VPS before and after the copy (pre-command and post-command). .git/ and .github/ never go.
What you need
A VPS on your account, a Linux or macOS runner (they have rsync, ssh and Python 3, and nothing is downloaded) and an API key created in the API Center of My MozOut.
Installing, step by step
|
|
|
|
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mozout-com/deploy-on-vps@v1
with:
api-key: ${{ secrets.MOZOUT_API_KEY }}
ssh-private-key: ${{ secrets.VPS_SSH_KEY }}
known-hosts: ${{ secrets.VPS_KNOWN_HOSTS }}
source: ./public
target: /var/www/html
delete: true
exclude: |
.env
uploads/
post-command: systemctl reload nginx
If your site needs a build, do it in a step before the action. The full list of inputs and the releases are in the action repository, and the latest release tells you what changed.
The API key and its permissions
The key needs vps:read. Add vps:write only if you want to use start-if-stopped.
If your key only accepts some IP addresses, remember that GitHub runners change IP. Use a self-hosted runner or leave the IP list empty for this key.
Testing without spending
With a sandbox_ key the API calls are simulated: starting a stopped server does nothing. The copy itself is real, because it goes over SSH. To see what would be copied without copying, use dry-run.
Good to know
Careful with delete: with delete: true, files on the VPS that are not in source are deleted. Put what must stay in exclude, such as .env or the uploads/ folder.
User and port: by default it connects as root on port 22. Change them with ssh-user and ssh-port. To connect through an additional IP, use host.
Outputs: server-id, server-name, ip and power-state.
Help
If the deploy fails with an error you do not understand, open a support ticket and copy the message from the workflow log. The servers part of the API is described in servers, in the API documentation. The code is in the action repository, under the MIT license.
|
Ready to publish your site on every push? Download the latest release |
|
SEE ALSO |
RECOMMENDED PRODUCT VPS server with root access Resources of your own, the OS you choose, reinstall whenever you like. from £6.72/mo (3-year plan, with coupon) See plans |











