Docs/Automation
Feature guide1 of 1 in section

GitHub Actions Workflows

How to wire Shipper into CI workflows for production deploys, preview environments, and cleanup jobs.

GitHub Actions Workflows

This page explains how to automate Shipper from GitHub Actions.

Reusable Shipper Action

- uses: shippercli/actions/.github/actions/shipper@c2c276e12f831ba2c3377a063d579fede5cc5ecc
  with:
    command: apply
    project: api
    profile: production
    force: true
    providers: |
      shippercli/provider-cpanel:^1.0
  env:
    CPANEL_API_TOKEN: ${{ secrets.CPANEL_API_TOKEN }}

Supported inputs:

  • command
  • project
  • profile
  • force
  • providers (required)
  • cli-version
  • php-version

Provider secrets vary by provider. Confirm the exact variable names on the provider page.

Production Workflow Example

name: Deploy Production

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: shippercli/actions/.github/actions/shipper@c2c276e12f831ba2c3377a063d579fede5cc5ecc
        with:
          command: apply
          project: api
          profile: production
          force: true
          providers: |
            shippercli/provider-cpanel:^1.0
        env:
          CPANEL_API_TOKEN: ${{ secrets.CPANEL_API_TOKEN }}

Preview Workflow Example

name: Deploy Preview

on:
  pull_request:
    types: [opened, synchronize, reopened]

jobs:
  preview:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: shippercli/actions/.github/actions/shipper@c2c276e12f831ba2c3377a063d579fede5cc5ecc
        with:
          command: apply
          project: api
          profile: preview
          force: true
          providers: |
            shippercli/provider-cpanel:^1.0
        env:
          CPANEL_API_TOKEN: ${{ secrets.CPANEL_API_TOKEN }}
          GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
          GITHUB_HEAD_REF: ${{ github.head_ref }}

Cleanup Workflow Example

name: Destroy Preview

on:
  pull_request:
    types: [closed]

jobs:
  cleanup:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: shippercli/actions/.github/actions/shipper@c2c276e12f831ba2c3377a063d579fede5cc5ecc
        with:
          command: destroy
          project: api
          profile: preview
          force: true
          providers: |
            shippercli/provider-cpanel:^1.0
        env:
          CPANEL_API_TOKEN: ${{ secrets.CPANEL_API_TOKEN }}
          GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
          GITHUB_HEAD_REF: ${{ github.head_ref }}

Failure Modes

  • wrong secret names for the selected provider
  • missing PR context variables in preview workflows
  • running destructive cleanup on the wrong profile