This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
Deploy to Cloudflare Worker #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.3.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.UBIQUITY_BOUNTY_BOT_APP_ID }} | |
private_key: ${{ secrets.UBIQUITY_BOUNTY_BOT_PRIVATE_KEY }} | |
- name: Publish to Cloudflare | |
env: | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
WEBHOOK: "/endpoint" | |
SECRET: ${{ secrets.BOT_SECRET }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
DEFAULT_PRIORITY: "Priority: 0 (Normal)" | |
INSTALLATION_TOKEN: ${{ steps.get_installation_token.outputs.token }} | |
run: | | |
# Populate Cloudflare Worker secrets | |
echo "$TOKEN" | wrangler secret put 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 "$INSTALLATION_TOKEN" | wrangler secret put INSTALLATION_TOKEN | |
yarn deploy |