Skip to content

use node 22 features #28

use node 22 features

use node 22 features #28

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
paths:
- 'scripts/**'
- 'src/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'wrangler.toml'
jobs:
deploy:
name: Deploy Commands & Worker
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Install pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
- name: Install Node 22
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Create empty .dev.vars file
run: touch .dev.vars
- name: Deploy commands to Discord
run: node --run deploy-commands
env:
APPLICATION_ID: ${{ secrets.APPLICATION_ID }}
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
# The wrangler action normally installs a hardcoded version of wrangler.
# This step gets the version we use from package.json.
# See https://github.com/cloudflare/wrangler-action/issues/231#issuecomment-1976018383.
- name: Set wrangler version
id: wrangler
run: echo "version=$(jq -r .devDependencies.wrangler package.json | cut -c2-)" >> "$GITHUB_OUTPUT"
- name: Build & Deploy Worker
uses: cloudflare/wrangler-action@7c01cc48d88a1f83b4716e0557c168854a9dcdb8 # v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
wranglerVersion: ${{ steps.wrangler.outputs.version }}
secrets: |
DISCORD_WEBHOOK
PUBLIC_KEY
WEBHOOK_SECRET
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
PUBLIC_KEY: ${{ secrets.PUBLIC_KEY }}
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }}