GitHub Actions

The official haloydev/deploy-action GitHub Action handles installing the Haloy CLI and running haloy deploy in your CI pipeline. Push to main, and your app deploys.

Quick Start

Add this workflow file to your repository:

# .github/workflows/deploy.yml name: Deploy on: push: branches: [main] jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: haloydev/deploy-action@v1 with: api-token: ${{ secrets.HALOY_API_TOKEN }}

That’s it. Every push to main will build and deploy your application.

Setup

1. Get Your API Token

On your server, run:

sudo haloyd config get api-token

2. Add the Token to GitHub

  1. Go to your repository on GitHub
  2. Navigate to Settings > Secrets and variables > Actions
  3. Click New repository secret
  4. Name: HALOY_API_TOKEN
  5. Value: paste your API token

3. Add the Workflow File

Create .github/workflows/deploy.yml in your repository with the workflow shown above, then push to main.

Action Inputs

InputRequiredDefaultDescription
api-tokenYesHaloy API token for server authentication
targetNoDeployment target name (for multi-target configs)
configNo./haloy.yamlPath to config file
versionNolatestHaloy CLI version to install

Examples

Deploy a Specific Target

- uses: haloydev/deploy-action@v1 with: api-token: ${{ secrets.HALOY_API_TOKEN }} target: production

Custom Config Path

- uses: haloydev/deploy-action@v1 with: api-token: ${{ secrets.HALOY_API_TOKEN }} config: ./deploy/haloy.yaml

Pin CLI Version

- uses: haloydev/deploy-action@v1 with: api-token: ${{ secrets.HALOY_API_TOKEN }} version: v0.1.0

Deploy Staging and Production

name: Deploy on: push: branches: [main, staging] jobs: deploy-staging: if: github.ref == 'refs/heads/staging' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: haloydev/deploy-action@v1 with: api-token: ${{ secrets.HALOY_API_TOKEN }} target: staging deploy-production: if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: haloydev/deploy-action@v1 with: api-token: ${{ secrets.HALOY_API_TOKEN }} target: production

Deploy with Manual Approval

name: Deploy Production on: push: branches: [main] jobs: deploy: runs-on: ubuntu-latest environment: production steps: - uses: actions/checkout@v4 - uses: haloydev/deploy-action@v1 with: api-token: ${{ secrets.HALOY_API_TOKEN }}

To require approval, configure a deployment protection rule on the production environment in your repository settings.

Run Tests Before Deploying

name: Test and Deploy on: push: branches: [main] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: npm ci - run: npm test deploy: needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: haloydev/deploy-action@v1 with: api-token: ${{ secrets.HALOY_API_TOKEN }}

How It Works

The action downloads the Haloy CLI for the runner’s platform, sets HALOY_API_TOKEN, and runs haloy deploy --no-logs with any flags you specify. The Docker image is built on the GitHub Actions runner and uploaded to your server via the Haloy API, the same way haloy deploy works from your local machine.

Security

Your API token is stored as a GitHub Actions secret and never exposed in logs. It authenticates using the same bearer token mechanism as the CLI, so no additional server-side configuration is needed.

Without the Action

If you’d rather skip the action, you can install the CLI directly:

jobs: deploy: runs-on: ubuntu-latest env: HALOY_API_TOKEN: ${{ secrets.HALOY_API_TOKEN }} steps: - uses: actions/checkout@v4 - name: Install Haloy run: | curl -fsSL -o /usr/local/bin/haloy \ https://github.com/haloydev/haloy/releases/latest/download/haloy-linux-amd64 chmod +x /usr/local/bin/haloy - run: haloy deploy --no-logs

This works with any CI provider, not just GitHub Actions.

Next Steps

Stay updated on Haloy

Get notified about new docs, deployment patterns, and Haloy updates.