Skip to content

fix: rewrite workflow for new Deno Deploy platform (console.deno.com) #30

fix: rewrite workflow for new Deno Deploy platform (console.deno.com)

fix: rewrite workflow for new Deno Deploy platform (console.deno.com) #30

name: Deploy Kilo Proxy to Deno Deploy
on:
workflow_dispatch:
push:
paths:
- 'cloudflare-worker/kilo-proxy/kilo_proxy.ts'
- '.github/workflows/deploy-kilo-proxy.yml'
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Install Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Create app if not exists & Deploy
env:
DENO_DEPLOY_TOKEN: ${{ secrets.DENO_DEPLOY_TOKEN }}
run: |
ORG="android-poweruser"
APP="screenoperator-kilo-proxy"
ENTRYPOINT="cloudflare-worker/kilo-proxy/kilo_proxy.ts"
echo "=== Attempting deploy ===" 2>&1 | tee /tmp/deploy_log.txt
# Try deploy first (app might already exist)
deno deploy \
--org="$ORG" \
--app="$APP" \
--token="$DENO_DEPLOY_TOKEN" \
--prod \
"$ENTRYPOINT" >> /tmp/deploy_log.txt 2>&1
DEPLOY_EXIT=$?
if [ $DEPLOY_EXIT -ne 0 ]; then
echo "=== Deploy failed, trying to create app first ===" >> /tmp/deploy_log.txt 2>&1
deno deploy create \
--org="$ORG" \
--app="$APP" \
--token="$DENO_DEPLOY_TOKEN" \
--source=local \
--runtime-mode=dynamic \
--entrypoint="$ENTRYPOINT" \
--region=us >> /tmp/deploy_log.txt 2>&1
echo "=== Retrying deploy ===" >> /tmp/deploy_log.txt
deno deploy \
--org="$ORG" \
--app="$APP" \
--token="$DENO_DEPLOY_TOKEN" \
--prod \
"$ENTRYPOINT" >> /tmp/deploy_log.txt 2>&1
DEPLOY_EXIT=$?
fi
cat /tmp/deploy_log.txt
exit $DEPLOY_EXIT
- name: Save log
if: always()
run: |
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
git add scripts/deploy_log.txt 2>/dev/null || true
cp /tmp/deploy_log.txt scripts/deploy_log.txt
git add scripts/deploy_log.txt
git commit -m "ci: deploy log [skip ci]" || true
git push || true