1+ name : Release Deployment and Security Scan
2+
3+ on :
4+ release :
5+ types : [published]
6+
7+ jobs :
8+ deploy-and-scan :
9+ runs-on : ubuntu-latest
10+
11+ steps :
12+ - name : Checkout code
13+ uses : actions/checkout@v4
14+
15+ - name : Determine release type and set channel
16+ id : release_type
17+ run : |
18+ if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
19+ echo "channel=rc" >> $GITHUB_OUTPUT
20+ echo "release_type=RC" >> $GITHUB_OUTPUT
21+ else
22+ echo "channel=release" >> $GITHUB_OUTPUT
23+ echo "release_type=Official" >> $GITHUB_OUTPUT
24+ fi
25+
26+ - name : Display release info
27+ run : |
28+ echo "Processing ${{ steps.release_type.outputs.release_type }} Release"
29+ echo "Release Tag: ${{ github.event.release.tag_name }}"
30+ echo "Install Channel: ${{ steps.release_type.outputs.channel }}"
31+
32+ - name : Download and run install script with sudo
33+ run : |
34+ wget -O install.sh https://websoft9.github.io/websoft9/install/install.sh
35+ sudo bash install.sh --channel ${{ steps.release_type.outputs.channel }}
36+
37+ - name : Wait for services to initialize
38+ run : |
39+ echo "Waiting 30 seconds for all services to fully start..."
40+ sleep 30
41+
42+ - name : Check Cockpit accessibility (Port 9000)
43+ run : |
44+ echo "Checking if Cockpit is accessible on port 9000..."
45+ if curl -f -s -o /dev/null -w "%{http_code}" http://localhost:9000 > /dev/null 2>&1 || \
46+ curl -f -s -k -o /dev/null http://localhost:9000 > /dev/null 2>&1; then
47+ echo "✅ Cockpit is accessible on port 9000"
48+ else
49+ echo "❌ ERROR: Cockpit access failed on port 9000"
50+ exit 1
51+ fi
52+
53+ - name : Check container status
54+ run : |
55+ echo "Checking status of critical containers..."
56+ containers=("websoft9-apphub" "websoft9-proxy" "websoft9-git" "websoft9-deployment")
57+ failed_containers=()
58+
59+ for container in "${containers[@]}"; do
60+ if docker ps --format '{{.Names}}' | grep -q "^${container}$"; then
61+ status=$(docker inspect --format='{{.State.Status}}' ${container})
62+ health=$(docker inspect --format='{{.State.Health.Status}}' ${container} 2>/dev/null || echo "no-healthcheck")
63+
64+ if [ "$status" = "running" ]; then
65+ if [ "$health" = "healthy" ] || [ "$health" = "no-healthcheck" ]; then
66+ echo "✅ ${container}: status=${status}, health=${health}"
67+ else
68+ echo "⚠️ ${container}: status=${status}, health=${health} (unhealthy)"
69+ failed_containers+=("${container}:health=${health}")
70+ fi
71+ else
72+ echo "❌ ${container}: status=${status}"
73+ failed_containers+=("${container}:status=${status}")
74+ fi
75+ else
76+ echo "❌ ${container}: NOT FOUND"
77+ failed_containers+=("${container}:not-found")
78+ fi
79+ done
80+
81+ if [ ${#failed_containers[@]} -gt 0 ]; then
82+ echo ""
83+ echo "========================================="
84+ echo "ERROR: The following containers have issues:"
85+ for item in "${failed_containers[@]}"; do
86+ echo " - $item"
87+ done
88+ echo "========================================="
89+ exit 1
90+ else
91+ echo ""
92+ echo "✅ All containers are running normally"
93+ fi
94+
95+ - name : Display container logs on failure
96+ if : failure()
97+ run : |
98+ echo "========================================="
99+ echo "Container logs for debugging:"
100+ echo "========================================="
101+ containers=("websoft9-apphub" "websoft9-proxy" "websoft9-git" "websoft9-deployment")
102+ for container in "${containers[@]}"; do
103+ if docker ps -a --format '{{.Names}}' | grep -q "^${container}$"; then
104+ echo ""
105+ echo "--- Logs for ${container} ---"
106+ docker logs --tail 50 ${container} || echo "Failed to get logs for ${container}"
107+ fi
108+ done
109+
110+
0 commit comments