Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Deploy to Cloudflare Worker #159

Deploy to Cloudflare Worker

Deploy to Cloudflare Worker #159

name: Deploy to Cloudflare Worker
on:
workflow_run:
workflows: ["Conventional Commits"]
types:
- completed
jobs:
deploy-to-cloudflare:
name: Deploy to Cloudflare Worker
runs-on: ubuntu-22.04
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "20.10.0"
- name: Yarn Install
run: yarn install
- name: Wrangler Install
run: npm install -g wrangler
- name: Get UbiquiBot Token
uses: tibdex/[email protected]
id: get_installation_token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Publish to Cloudflare
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
WEBHOOK: "/endpoint"
SECRET: ${{ secrets.BOT_SECRET }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
SUPABASE_KEY: ${{ secrets.SUPABASE_PROJECT_KEY }}
SUPABASE_URL: ${{ secrets.SUPABASE_PROJECT_URL }}
DEFAULT_PRIORITY: "Priority: 0 (Normal)"
GITHUB_OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
GITHUB_OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
LOG_WEBHOOK_SECRET: ${{ secrets.LOG_WEBHOOK_SECRET }}
GITHUB_INSTALLATION_TOKEN: ${{ steps.get_installation_token.outputs.token }}
run: |
# Populate Cloudflare Worker secrets
echo "$TELEGRAM_BOT_TOKEN" | wrangler secret put TELEGRAM_BOT_TOKEN
echo "$WEBHOOK" | wrangler secret put WEBHOOK
echo "$SECRET" | wrangler secret put SECRET
echo "$OPENAI_API_KEY" | wrangler secret put OPENAI_API_KEY
echo "$DEFAULT_PRIORITY" | wrangler secret put DEFAULT_PRIORITY
echo "$GITHUB_OAUTH_CLIENT_ID" | wrangler secret put GITHUB_OAUTH_CLIENT_ID
echo "$GITHUB_OAUTH_CLIENT_SECRET" | wrangler secret put GITHUB_OAUTH_CLIENT_SECRET
echo "$LOG_WEBHOOK_SECRET" | wrangler secret put LOG_WEBHOOK_SECRET
echo "$GITHUB_INSTALLATION_TOKEN" | wrangler secret put GITHUB_INSTALLATION_TOKEN
echo "$SUPABASE_URL" | wrangler secret put SUPABASE_URL
echo "$SUPABASE_KEY" | wrangler secret put SUPABASE_KEY
yarn deploy