Skip to content

Commit f8682c9

Browse files
fix: replace Railway with Cloudflare Pages deploy
1 parent 50b2b48 commit f8682c9

1 file changed

Lines changed: 15 additions & 97 deletions

File tree

.github/workflows/auto-deploy.yml

Lines changed: 15 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,33 @@
1-
name: 🚀 Auto Deploy
1+
name: "🚀 Auto Deploy"
22

33
on:
44
push:
55
branches: [main, master]
66
workflow_dispatch:
77

8-
env:
9-
NODE_VERSION: '20'
10-
118
jobs:
12-
detect-service:
13-
name: Detect Service Type
14-
runs-on: ubuntu-latest
15-
outputs:
16-
service_type: ${{ steps.detect.outputs.service_type }}
17-
deploy_target: ${{ steps.detect.outputs.deploy_target }}
18-
19-
steps:
20-
- name: Checkout
21-
uses: actions/checkout@v6
22-
23-
- name: Detect Service Type
24-
id: detect
25-
run: |
26-
if [ -f "next.config.mjs" ] || [ -f "next.config.js" ]; then
27-
echo "service_type=nextjs" >> $GITHUB_OUTPUT
28-
echo "deploy_target=cloudflare" >> $GITHUB_OUTPUT
29-
elif [ -f "Dockerfile" ]; then
30-
echo "service_type=docker" >> $GITHUB_OUTPUT
31-
echo "deploy_target=railway" >> $GITHUB_OUTPUT
32-
elif [ -f "package.json" ]; then
33-
echo "service_type=node" >> $GITHUB_OUTPUT
34-
echo "deploy_target=railway" >> $GITHUB_OUTPUT
35-
elif [ -f "requirements.txt" ]; then
36-
echo "service_type=python" >> $GITHUB_OUTPUT
37-
echo "deploy_target=railway" >> $GITHUB_OUTPUT
38-
else
39-
echo "service_type=static" >> $GITHUB_OUTPUT
40-
echo "deploy_target=cloudflare" >> $GITHUB_OUTPUT
41-
fi
42-
43-
deploy-cloudflare:
9+
deploy:
4410
name: Deploy to Cloudflare Pages
45-
needs: detect-service
46-
if: needs.detect-service.outputs.deploy_target == 'cloudflare'
4711
runs-on: ubuntu-latest
48-
4912
steps:
5013
- name: Checkout
51-
uses: actions/checkout@v6
52-
14+
uses: actions/checkout@v4
15+
5316
- name: Setup Node
54-
uses: actions/setup-node@v6
17+
uses: actions/setup-node@v4
5518
with:
56-
node-version: ${{ env.NODE_VERSION }}
57-
cache: 'npm'
58-
59-
- name: Install Dependencies
60-
run: npm ci
61-
62-
- name: Build
63-
run: npm run build
64-
env:
65-
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ secrets.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }}
66-
19+
node-version: '20'
20+
21+
- name: Install & Build
22+
run: |
23+
if [ -f "package.json" ]; then
24+
npm install
25+
npm run build 2>/dev/null || true
26+
fi
27+
6728
- name: Deploy to Cloudflare Pages
6829
uses: cloudflare/wrangler-action@v3
6930
with:
7031
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
7132
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
72-
command: pages deploy .next --project-name=${{ github.event.repository.name }}
73-
74-
deploy-railway:
75-
name: Deploy to Railway
76-
needs: detect-service
77-
if: needs.detect-service.outputs.deploy_target == 'railway'
78-
runs-on: ubuntu-latest
79-
80-
steps:
81-
- name: Checkout
82-
uses: actions/checkout@v6
83-
84-
- name: Install Railway CLI
85-
run: npm i -g @railway/cli
86-
87-
- name: Deploy to Railway
88-
run: railway up --service ${{ github.event.repository.name }}
89-
env:
90-
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
91-
92-
health-check:
93-
name: Health Check
94-
needs: [deploy-cloudflare, deploy-railway]
95-
if: always() && (needs.deploy-cloudflare.result == 'success' || needs.deploy-railway.result == 'success')
96-
runs-on: ubuntu-latest
97-
98-
steps:
99-
- name: Wait for Deployment
100-
run: sleep 30
101-
102-
- name: Check Health Endpoint
103-
run: |
104-
URL="${{ secrets.DEPLOY_URL }}/api/health"
105-
curl -f $URL || exit 1
106-
107-
- name: Notify Success
108-
if: success()
109-
run: echo "✅ Deployment successful and healthy!"
110-
111-
- name: Notify Failure
112-
if: failure()
113-
run: |
114-
echo "❌ Deployment health check failed!"
115-
exit 1
33+
command: pages deploy . --project-name=${{ github.event.repository.name }}

0 commit comments

Comments
 (0)