Skip to content

Create CNAME

Create CNAME #19

Workflow file for this run

name: Deploy Kanariya
on:
workflow_dispatch:
inputs:
update_secrets:
description: "Update Worker secrets before deploy (uses repo secrets)"
required: false
default: "false"
push:
branches: ["main"]
permissions:
contents: read
concurrency:
group: deploy-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Install Wrangler
run: npm install -g wrangler@3
- name: Validate Cloudflare secrets
env:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
run: |
set -euo pipefail
missing=0
if [ -z "${CF_API_TOKEN}" ]; then
echo "::error::Missing required secret: CF_API_TOKEN"
missing=1
fi
if [ -z "${CF_ACCOUNT_ID}" ]; then
echo "::error::Missing required secret: CF_ACCOUNT_ID"
missing=1
fi
exit "${missing}"
- name: Update Worker secrets
if: github.event_name == 'workflow_dispatch' && github.event.inputs.update_secrets == 'true'
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
IP_HMAC_KEY: ${{ secrets.IP_HMAC_KEY }}
ADMIN_KEY: ${{ secrets.ADMIN_KEY }}
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
run: |
set -euo pipefail
if [ -n "${IP_HMAC_KEY}" ]; then
printf '%s' "${IP_HMAC_KEY}" | wrangler secret put IP_HMAC_KEY
fi
if [ -n "${ADMIN_KEY}" ]; then
printf '%s' "${ADMIN_KEY}" | wrangler secret put ADMIN_KEY
fi
if [ -n "${WEBHOOK_URL}" ]; then
printf '%s' "${WEBHOOK_URL}" | wrangler secret put WEBHOOK_URL
fi
- name: Deploy Worker
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
run: wrangler deploy