Deploy a Project
Deploy a project via Orion CLI
Prerequisites
Before you can deploy a project, make sure you are logged into your account (orion login) and have linked the folder to your server (orion link).
Deployment
At the root of your project, you should have an orion.config.json file similar to this:
{
"$schema": "https://orionhost.xyz/cli.schema.json",
"deploy": {
"clean": true,
"exclude": ["node_modules", ".git", ".env"]
}
}exclude should contain all files you don't want to deploy, such as modules and your environment variables.
When clean is true, files included in your deployment will first be deleted from the server before deployment.
Make sure to back up important files (e.g. .env, *.log, *.sqlite etc.) in case of accidental deletion.
Once the configuration is complete, run this command to start a deployment.
orion deployAutomated Deployment (CI/CD)
Example of a GitHub Actions workflow to automatically deploy your code.
In the settings, you need to add the Secret ORION_TOKEN corresponding to your token, and an Environment Variable ORION_SERVER_ID corresponding to the server identifier (serverId in your .orion/project.json).
name: Deploy on Orion
on:
# Deploy on push:
push:
branches: ["main"]
# Deploy on release:
release:
types: [published]
# Allow manual deploy:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
registry-url: "https://registry.npmjs.org"
- name: Install Orion CLI
run: npm i -g @orionhosting/cli@latest
- name: Install dependencies
run: npm ci
# If you have a build command and want to build faster,
# you should build here and only deploy the result files on Orion
# - name: Build
# run: npm run build
- name: Deploy
run: orion deploy
env:
ORION_TOKEN: ${{ secrets.ORION_TOKEN }}
ORION_SERVER_ID: ${{ vars.ORION_SERVER_ID }}