Skip to content

Commit d8bd1fe

Browse files
Add Deno Deploy workflow (re-created)
1 parent 6c28b34 commit d8bd1fe

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Deploy Kilo Proxy to Deno Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install Deno
16+
uses: denoland/setup-deno@v2
17+
with:
18+
deno-version: v2.x
19+
20+
- name: Deploy to Deno Deploy
21+
env:
22+
DENO_DEPLOY_TOKEN: ${{ secrets.DENO_DEPLOY_TOKEN }}
23+
run: |
24+
set -e
25+
26+
# Create project (ignore error if name taken)
27+
curl -s -X POST "https://api.deno.com/v1/projects" \
28+
-H "Authorization: Bearer $DENO_DEPLOY_TOKEN" \
29+
-H "Content-Type: application/json" \
30+
-d '{"name":"screenoperator-kilo-proxy"}' || true
31+
32+
# Deploy
33+
deno run -A jsr:@deno/deployctl deploy \
34+
--project=screenoperator-kilo-proxy \
35+
--token="$DENO_DEPLOY_TOKEN" \
36+
--no-static \
37+
cloudflare-worker/kilo-proxy/kilo_proxy.ts
38+
39+
# Get domain and write to file
40+
sleep 2
41+
INFO=$(curl -s "https://api.deno.com/v1/projects/screenoperator-kilo-proxy" \
42+
-H "Authorization: Bearer $DENO_DEPLOY_TOKEN")
43+
DOMAIN=$(echo "$INFO" | python3 -c "
44+
import sys,json
45+
try:
46+
p=json.load(sys.stdin)
47+
d=[x.get('domain','') for x in p.get('domains',[])]
48+
print(next((x for x in d if 'deno.dev' in x),'screenoperator-kilo-proxy.deno.dev'))
49+
except: print('screenoperator-kilo-proxy.deno.dev')
50+
")
51+
echo "Proxy URL: https://$DOMAIN"
52+
echo "https://$DOMAIN" > cloudflare-worker/kilo-proxy/PROXY_URL.txt
53+
git config user.name "github-actions[bot]"
54+
git config user.email "github-actions[bot]@users.noreply.github.com"
55+
git add cloudflare-worker/kilo-proxy/PROXY_URL.txt
56+
git diff --staged --quiet || git commit -m "chore: save proxy URL [skip ci]"
57+
git push || true

0 commit comments

Comments
 (0)