this site now uses github actions for deployments!!

#devops#ci-cd

A big part of my role in DevOps is creating and maintaining CI/CD pipelines with tools like Jenkins and GitHub Actions.

I wanted to experiment with this myself and create a pipeline for changes to the main branch of this site's repo, as part of my ongoing commitment to spend more time on backend than frontend.

To this end, I created a simple CD script using GitHub Actions, which pulls down my latest changes and then redeploys my Docker containers for the site itself and my nginx. This means I don't have to ssh into my server to make changes to the site, and can test updates locally before pushing.

name: deploy

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: redeploy containers
        run: |
          docker compose pull
          docker compose up -d --force-recreate

The whole thing is about 15 lines. Jenkins would have been overkill.