Files
server-scripts/.gitea/workflows/haven-notify.yaml
Jose Henrique 65efcc4709
All checks were successful
Check scripts syntax / check-scripts-syntax (push) Successful in 1s
pipe
2025-08-16 22:08:56 -03:00

121 lines
3.1 KiB
YAML

name: Haven Notify Build and Deploy
on:
push:
branches:
- main
paths:
- 'haven-notify/**'
workflow_dispatch: {}
env:
REGISTRY_HOST: git.ivanch.me
REGISTRY_USERNAME: ivanch
IMAGE_NOTIFY: ${{ env.REGISTRY_HOST }}/ivanch/haven-notify
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
jobs:
build_haven_notify:
name: Build Haven Notify Image (arm64)
runs-on: ubuntu-arm64
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Install Docker
run: |
apt-get update
apt-get install -y docker.io
- name: Log in to Container Registry
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" \
| docker login "${{ env.REGISTRY_HOST }}" \
-u "${{ env.REGISTRY_USERNAME }}" \
--password-stdin
- name: Build and Push Image
run: |
TAG=latest
cd haven-notify
docker build \
-t "${{ env.IMAGE_NOTIFY }}:${TAG}" \
-f Dockerfile .
docker push "${{ env.IMAGE_NOTIFY }}:${TAG}"
build_haven_notify_amd64:
name: Build Haven Notify Image (amd64)
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Log in to Container Registry
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" \
| docker login "${{ env.REGISTRY_HOST }}" \
-u "${{ env.REGISTRY_USERNAME }}" \
--password-stdin
- name: Display Directory Structure
run: |
echo "Current directory structure:"
ls -lR .
- name: Build and Push Image
run: |
TAG=latest
cd haven-notify
docker build \
-t "${{ env.IMAGE_NOTIFY }}:${TAG}" \
-f Dockerfile .
docker push "${{ env.IMAGE_NOTIFY }}:${TAG}"
deploy_haven_notify:
name: Deploy Haven Notify
runs-on: ubuntu-arm64
needs: build_haven_notify
steps:
- name: Check KUBE_CONFIG validity
run: |
if [ -z "${KUBE_CONFIG}" ] || [ "${KUBE_CONFIG}" = "" ] || [ "${KUBE_CONFIG// }" = "" ]; then
echo "KUBE_CONFIG is not set or is empty."
exit 1
fi
- name: Check out repository
uses: actions/checkout@v2
- name: Download and install kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
install -m 0755 kubectl /usr/local/bin/kubectl
kubectl version --client
- name: Set up kubeconfig
run: |
cd haven-notify/deploy
echo "$KUBE_CONFIG" > kubeconfig.yaml
env:
KUBE_CONFIG: ${{ env.KUBE_CONFIG }}
- name: Test connection to cluster
run: |
kubectl --kubeconfig=kubeconfig.yaml cluster-info
- name: Apply haven-notify deployment
run: |
kubectl --kubeconfig=kubeconfig.yaml apply -f haven-notify.yaml
- name: Rollout restart haven-notify
run: |
kubectl --kubeconfig=kubeconfig.yaml rollout restart deployment/haven-notify