Home Pricing
Documentation Blog About
Login Start free
Back to Blog

Building a CI/CD pipeline with GitHub Actions

Step-by-step guide to automating your deployments with GitHub Actions and Shipyard for seamless continuous delivery.

CI/CD Pipeline

Continuous Integration and Continuous Deployment (CI/CD) is the backbone of modern software development. In this tutorial, we'll build a complete pipeline using GitHub Actions and Shipyard.

What You'll Learn

By the end of this tutorial, you'll have a fully automated pipeline that:

  • Runs tests on every pull request
  • Builds and deploys to staging on merge to main
  • Promotes to production with a single click

Prerequisites

Before we start, make sure you have:

  1. A GitHub account with a repository
  2. A Shipyard account (free tier works fine)
  3. Basic familiarity with YAML syntax

Step 1: Create Your Workflow File

Create a new file at .github/workflows/deploy.yml in your repository:

name: Deploy to Shipyard

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - run: npm ci
      - run: npm test

  deploy:
    needs: test
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Deploy to Shipyard
        run: npx shipyard deploy
        env:
          SHIPYARD_TOKEN: ${{ secrets.SHIPYARD_TOKEN }}

Step 2: Configure Secrets

Go to your repository Settings → Secrets → Actions and add:

  • SHIPYARD_TOKEN: Your API token from the Shipyard dashboard

"Automation is not about replacing humans, it's about freeing them to do more meaningful work."

— DevOps Handbook

Step 3: Add Environment Protection

For production deployments, add manual approval:

deploy-production:
    needs: deploy-staging
    runs-on: ubuntu-latest
    environment:
      name: production
      url: https://your-app.shipyard.dev
    steps:
      - uses: actions/checkout@v4
      - run: npx shipyard deploy --env production
10x Faster deployments
Zero Manual steps
100% Reproducible

Best Practices

  1. Keep workflows fast: Cache dependencies to speed up builds
  2. Use matrix builds: Test across multiple Node versions
  3. Add status badges: Show build status in your README
  4. Monitor failures: Set up Slack/Discord notifications

Conclusion

You now have a production-ready CI/CD pipeline! Every push to main will automatically deploy your application to Shipyard. For more advanced configurations, check out our documentation.

Sarah Miller

DevOps Engineer at Shipyard

Sarah specializes in CI/CD pipelines and infrastructure automation. She's passionate about helping teams ship faster and more reliably.