promiscuity/.gitea/workflows/deploy-world.yml
Zeeshaun bed8e91bc0
Some checks failed
Deploy Promiscuity Auth API / deploy (push) Successful in 48s
Deploy Promiscuity Character API / deploy (push) Successful in 47s
Deploy Promiscuity Crafting API / deploy (push) Successful in 47s
Deploy Promiscuity Inventory API / deploy (push) Successful in 46s
Deploy Promiscuity Locations API / deploy (push) Successful in 47s
Deploy Promiscuity Mail API / deploy (push) Successful in 46s
Deploy Promiscuity World API / deploy (push) Failing after 47s
k8s smoke test / test (push) Successful in 9s
Adding world workflow
2026-04-01 19:58:15 +00:00

82 lines
2.4 KiB
YAML

name: Deploy Promiscuity World API
on:
push:
branches:
- main
workflow_dispatch: {}
jobs:
deploy:
runs-on: self-hosted
env:
IMAGE_NAME: promiscuity-world:latest
IMAGE_TAR: /tmp/promiscuity-world.tar
NODES: "192.168.86.72 192.168.86.73 192.168.86.74"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Build Docker image
run: |
cd microservices/WorldApi
docker build -t "${IMAGE_NAME}" .
- name: Save Docker image to TAR
run: |
docker save "${IMAGE_NAME}" -o "${IMAGE_TAR}"
- name: Copy TAR to nodes
run: |
for node in ${NODES}; do
echo "Copying image tar to $node ..."
scp -o StrictHostKeyChecking=no "${IMAGE_TAR}" hz@"$node":/tmp/promiscuity-world.tar
done
- name: Import image on nodes
run: |
for node in ${NODES}; do
echo "Importing image on $node ..."
ssh -o StrictHostKeyChecking=no hz@"$node" "sudo ctr -n k8s.io images import /tmp/promiscuity-world.tar"
done
- name: Clean TAR from nodes
run: |
for node in ${NODES}; do
echo "Removing image tar on $node ..."
ssh -o StrictHostKeyChecking=no hz@"$node" "rm -f /tmp/promiscuity-world.tar"
done
- name: Clean TAR on runner
run: |
rm -f "${IMAGE_TAR}"
- name: Write kubeconfig from secret
env:
KUBECONFIG_CONTENT: ${{ secrets.KUBECONFIG }}
run: |
mkdir -p /tmp/kube
printf '%s\n' "$KUBECONFIG_CONTENT" > /tmp/kube/config
- name: Create namespace if missing
env:
KUBECONFIG: /tmp/kube/config
run: |
kubectl create namespace promiscuity-world --dry-run=client -o yaml | kubectl apply -f -
- name: Apply World deployment & service
env:
KUBECONFIG: /tmp/kube/config
run: |
kubectl apply -f microservices/WorldApi/k8s/deployment.yaml -n promiscuity-world
kubectl apply -f microservices/WorldApi/k8s/service.yaml -n promiscuity-world
- name: Restart World deployment
env:
KUBECONFIG: /tmp/kube/config
run: |
kubectl rollout restart deployment/promiscuity-world -n promiscuity-world
kubectl rollout status deployment/promiscuity-world -n promiscuity-world