Skip to content

Commit 317d649

Browse files
ci: fix YAML error - move Python to external script
1 parent e0da45d commit 317d649

1 file changed

Lines changed: 3 additions & 57 deletions

File tree

.github/workflows/deploy-kilo-proxy.yml

Lines changed: 3 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
paths:
77
- 'cloudflare-worker/kilo-proxy/kilo_proxy.ts'
8+
- 'scripts/deno_deploy.py'
89

910
jobs:
1011
deploy:
@@ -15,62 +16,7 @@ jobs:
1516
steps:
1617
- uses: actions/checkout@v4
1718

18-
- name: Deploy via Deno Deploy REST API
19+
- name: Deploy to Deno Deploy
1920
env:
2021
DENO_DEPLOY_TOKEN: ${{ secrets.DENO_DEPLOY_TOKEN }}
21-
run: |
22-
set -e
23-
24-
APP_NAME="screenoperator-kilo-proxy"
25-
SOURCE_FILE="cloudflare-worker/kilo-proxy/kilo_proxy.ts"
26-
DENO_API="https://api.deno.com/v1"
27-
28-
# 1. Get org slug from token
29-
ORG=$(curl -sf -H "Authorization: Bearer $DENO_DEPLOY_TOKEN" \
30-
"$DENO_API/user" | python3 -c "
31-
import sys,json
32-
u=json.load(sys.stdin)
33-
orgs=u.get('organizations',[])
34-
print(orgs[0]['name'] if orgs else u.get('name',''))
35-
")
36-
echo "Org: $ORG"
37-
38-
# 2. Create app (ignore 409 conflict = already exists)
39-
HTTP=$(curl -s -o /dev/null -w "%{http_code}" \
40-
-X POST "$DENO_API/organizations/$ORG/projects" \
41-
-H "Authorization: Bearer $DENO_DEPLOY_TOKEN" \
42-
-H "Content-Type: application/json" \
43-
-d "{\"name\":\"$APP_NAME\"}")
44-
echo "Create app HTTP: $HTTP"
45-
46-
# 3. Read source file and build assets payload
47-
CODE=$(cat "$SOURCE_FILE")
48-
PAYLOAD=$(python3 -c "
49-
import json, sys
50-
code = open('$SOURCE_FILE').read()
51-
assets = {
52-
'main.ts': {
53-
'kind': 'file',
54-
'content': code,
55-
'encoding': 'utf-8'
56-
}
57-
}
58-
print(json.dumps({
59-
'entryPointUrl': 'main.ts',
60-
'assets': assets,
61-
'envVars': {}
62-
}))
63-
")
64-
65-
# 4. Deploy
66-
RESULT=$(curl -sf -X POST "$DENO_API/projects/$APP_NAME/deployments" \
67-
-H "Authorization: Bearer $DENO_DEPLOY_TOKEN" \
68-
-H "Content-Type: application/json" \
69-
-d "$PAYLOAD")
70-
echo "Deploy result: $RESULT"
71-
echo "$RESULT" | python3 -c "
72-
import sys,json
73-
d=json.load(sys.stdin)
74-
domains=d.get('domains',[])
75-
print('Deployed to:', domains[0] if domains else 'check dashboard')
76-
"
22+
run: python3 scripts/deno_deploy.py

0 commit comments

Comments
 (0)