Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
name: Test
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.17'
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Run checks
run: npm run check

- name: Build
run: npm run build
54 changes: 54 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Deploy to Dokku

on:
push:
branches: [main]

jobs:
deploy:
name: Deploy to Production
runs-on: ubuntu-latest

steps:
- name: Deploy to Dokku
run: |
echo "Triggering deployment for commit ${{ github.sha }}"

response=$(curl -s -w "%{http_code}" -o response.json \
-X POST https://server.tooangel.com/deploy/worlddriven-webapp \
-H "Authorization: Bearer ${{ secrets.DEPLOY_WEBHOOK_SECRET }}" \
-H "Content-Type: application/json" \
-d '{
"repository": "${{ github.repository }}",
"commit": "${{ github.sha }}",
"branch": "${{ github.ref_name }}"
}')

http_code="${response: -3}"

echo "HTTP Status Code: $http_code"
echo "Response:"
cat response.json

if [ "$http_code" -ne 200 ]; then
echo "Deployment failed with HTTP status: $http_code"
exit 1
fi

echo "Deployment triggered successfully!"

- name: Verify Deployment
run: |
echo "Waiting 30 seconds for deployment to complete..."
sleep 30

echo "Checking if worlddriven webapp is responding..."
response=$(curl -s -w "%{http_code}" -o health.json https://webapp.worlddriven.org/ || echo "000")
http_code="${response: -3}"

if [ "$http_code" = "200" ]; then
echo "✅ Deployment successful - worlddriven webapp is responding"
else
echo "⚠️ Warning: worlddriven webapp may still be starting (HTTP $http_code)"
echo "This doesn't necessarily mean deployment failed."
fi