Skip to content

refactor: Update Cloudflare Workers deployment workflow to use new en… #8

refactor: Update Cloudflare Workers deployment workflow to use new en…

refactor: Update Cloudflare Workers deployment workflow to use new en… #8

Workflow file for this run

name: Deploy Cloudflare Worker and Run Discord Script
on:
push:
branches:
- main # Deploy on push to the main branch
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install dependencies
run: npm install
- name: Install Wrangler
run: npm install -g wrangler
- name: Extract repository name
id: extract
run: echo "REPO_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Deploy to Cloudflare Workers
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: wrangler deploy ./index.js --name ${{ env.REPO_NAME }} --compatibility-date 2024-05-20
- name: Run Discord script
env:
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
GUILD_ID: ${{ secrets.GUILD_ID }}
run: npm run discord