Continuous Deployment
Yesterday I explored using GitHub Actions workflows for continuous deployment. I used a pipeline that takes code pushed to GitHub all the way to production, deployed on a Kubernetes cluster on Azure cloud.
The deployment workflow is written in YAML, and in it there 4 levels:
- workflow
- jobs
- steps
- commands
- steps
- jobs
Here is an example workflow, from Chapter 8 of the book Bootstrapping Microservices, by Ashley Davis.
1name: Deploy microservice
2
3on:
4 push:
5 branches:
6 - main
7 workflow_dispatch:
8
9jobs:
10
11 deploy:
12 runs-on: ubuntu-latest
13
14 env:
15 VERSION: ${{ github.sha }}
16 CONTAINER_REGISTRY: ${{ secrets.CONTAINER_REGISTRY }}
17 REGISTRY_UN: ${{ secrets.REGISTRY_UN }}
18 REGISTRY_PW: ${{ secrets.REGISTRY_PW }}
19
20 steps:
21
22 - uses: actions/checkout@v3
23
24 - name: Build
25 run: ./scripts/build-image.sh
26
27 - name: Publish
28 run: ./scripts/push-image.sh
29
30 - uses: tale/kubectl-action@v1
31 with:
32 base64-kube-config: ${{ secrets.KUBE_CONFIG }}
33 kubectl-version: v1.26.0
34
35 - name: Deploy
36 run: ./scripts/deploy.sh