41 lines
1.0 KiB
YAML
41 lines
1.0 KiB
YAML
name: Deploy Auth Inbox to Cloudflare Workers
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
name: Deploy Auth Inbox Worker
|
|
steps:
|
|
# 步骤 1: 检出代码
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
# 步骤 2: 设置 Node.js 环境
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20' # 根据您的项目需求选择 Node.js 版本
|
|
|
|
# 步骤 3: 安装依赖项
|
|
- name: Install Dependencies
|
|
run: npm install
|
|
|
|
# 步骤 4: 部署 Worker
|
|
- name: Deploy Backend for ${{ github.ref_name }}
|
|
run: |
|
|
|
|
# Write secrets.TOML to wrangler.toml file
|
|
echo '${{ secrets.TOML }}' > wrangler.toml
|
|
|
|
# Deploy the worker using Wrangler
|
|
npx wrangler deploy
|
|
env:
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|