refactor: Update Cloudflare Workers deployment workflow to use new en… #7
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 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 }} | |
- 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 |