CI was configured for main only; project default branch is master. Co-Authored-By: Paperclip <noreply@paperclip.ing>
62 lines
1.7 KiB
YAML
62 lines
1.7 KiB
YAML
name: Build & Deploy — using.cash website
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
|
|
env:
|
|
REGISTRY: git.falkvinge.net
|
|
IMAGE_NAME: using-cash/website
|
|
NAMESPACE: using-cash
|
|
DEPLOYMENT: website
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set image tag
|
|
id: tag
|
|
run: echo "sha=${GITHUB_SHA::8}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Log in to Gitea container registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.sha }}
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
|
|
- name: Configure kubectl
|
|
uses: azure/k8s-set-context@v3
|
|
with:
|
|
method: kubeconfig
|
|
kubeconfig: ${{ secrets.KUBECONFIG }}
|
|
|
|
- name: Deploy to cluster
|
|
run: |
|
|
kubectl set image deployment/${{ env.DEPLOYMENT }} \
|
|
${{ env.DEPLOYMENT }}=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.sha }} \
|
|
-n ${{ env.NAMESPACE }}
|
|
|
|
- name: Wait for rollout
|
|
run: |
|
|
kubectl rollout status deployment/${{ env.DEPLOYMENT }} \
|
|
-n ${{ env.NAMESPACE }} --timeout=120s
|
|
|
|
- name: Verify deployment
|
|
run: |
|
|
kubectl get pods -n ${{ env.NAMESPACE }} -l app=${{ env.DEPLOYMENT }}
|