Skip to content

Commit d37d9a8

Browse files
committed
ci: add CI security scan and Coolify deploy workflow
1 parent c0444f5 commit d37d9a8

2 files changed

Lines changed: 89 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
security:
11+
name: Security Scan
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: ruby/setup-ruby@v1
18+
with:
19+
ruby-version: .ruby-version
20+
bundler-cache: true
21+
22+
- name: Brakeman
23+
run: bundle exec brakeman -q -w2 --no-pager
24+
25+
- name: Bundle Audit
26+
run: |
27+
gem install bundler-audit --no-document
28+
bundle-audit check --update
29+
30+
lint:
31+
name: RuboCop
32+
runs-on: ubuntu-latest
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- uses: ruby/setup-ruby@v1
38+
with:
39+
ruby-version: .ruby-version
40+
bundler-cache: true
41+
42+
- name: RuboCop
43+
run: bundle exec rubocop --parallel --format simple

.github/workflows/deploy.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Deploy to Production
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
jobs:
9+
deploy:
10+
name: Trigger Coolify Deploy
11+
runs-on: ubuntu-latest
12+
13+
environment:
14+
name: production
15+
url: https://kingslendas.com
16+
17+
steps:
18+
- name: Trigger Coolify webhook
19+
run: |
20+
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
21+
-X GET "${{ secrets.COOLIFY_WEBHOOK_URL }}")
22+
23+
if [ "$HTTP_STATUS" -ge 200 ] && [ "$HTTP_STATUS" -lt 300 ]; then
24+
echo "Deploy triggered successfully (HTTP $HTTP_STATUS)"
25+
else
26+
echo "Failed to trigger deploy (HTTP $HTTP_STATUS)"
27+
exit 1
28+
fi
29+
30+
- name: Wait for deploy and health check
31+
run: |
32+
echo "Waiting 60s for Coolify to build and start..."
33+
sleep 60
34+
35+
for i in {1..10}; do
36+
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://kingslendas.com/up)
37+
if [ "$HTTP_STATUS" -eq 200 ]; then
38+
echo "Health check passed (attempt $i)"
39+
exit 0
40+
fi
41+
echo "Attempt $i/10 — HTTP $HTTP_STATUS, retrying in 15s..."
42+
sleep 15
43+
done
44+
45+
echo "Health check failed after all attempts"
46+
exit 1

0 commit comments

Comments
 (0)