[PR #29] [MERGED] 新增 GitHub Actions 自动化部署(同步上游后自动Init数据库) #185

Closed
opened 2026-02-27 09:13:39 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/maillab/cloud-mail/pull/29
Author: @Silentely
Created: 7/7/2025
Status: Merged
Merged: 7/7/2025
Merged by: @eoao

Base: devHead: main


📝 Commits (3)

📊 Changes

3 files changed (+191 additions, -0 deletions)

View changed files

.github/workflows/deploy-cloudflare.yml (+117 -0)
📝 README.md (+38 -0)
mail-worker/wrangler-action.toml (+36 -0)

📄 Description

本次更新引入了 GitHub Actions,实现了项目到 Cloudflare Workers 的自动化部署。这大大简化了部署流程,并提供了详细的部署指南。

7d491ef7f65fbb6bccb11e7455d11989
50b4a3438149d8624e589aa8a6ca635a
2e5a54c5e227b7110ba461acc274529b

Github Action 部署

配置 Github 仓库

  1. Fork 或克隆仓库 https://github.com/eoao/cloud-mail
  2. 进入您的 GitHub 仓库设置
  3. 转到 Settings → Secrets and variables → Actions → New Repository secrets
  4. 添加以下 Secrets:
Secret 名称 必需 用途
CLOUDFLARE_API_TOKEN Cloudflare API 令牌(需要 Workers 和相关资源权限)
CLOUDFLARE_ACCOUNT_ID Cloudflare 账户 ID
D1_DATABASE_ID 您的 D1 数据库的 ID
KV_NAMESPACE_ID 您的 KV 命名空间的 ID
R2_BUCKET_NAME 您的 R2 存储桶的名称
DOMAIN 您要用于邮件服务的域名(例如 "["xx.xx"]",多域名用,分隔
ADMIN 您的管理员邮箱地址(例如 "admin@example.com"
JWT_SECRET 用于生成和验证 JWT 的随机长字符串
INIT_URL (可选)部署后用于初始化数据库的 Worker URL

获取 Cloudflare API 令牌

  1. 访问 Cloudflare Dashboard
  2. 创建新的 API 令牌
  3. 选择"编辑 Cloudflare Workers"模板,并参照下表添加相应权限
    dc2e1dc8dcd217644759c46c6c705de1
  4. 保存令牌并复制到 GitHub Secrets 中的 CLOUDFLARE_API_TOKEN

获取 Cloudflare 账户 ID

  1. 账户 ID 可以在 Cloudflare 仪表盘的账户设置中找到。
  2. 复制到 GitHub Secrets 中的 CLOUDFLARE_ACCOUNT_ID

运行工作流

  1. 然后在Action页面手手动运行工作流,后续同步上游后会自动部署到 Cloudflare Workers。如未配置 INIT_URL,则需要手动访问 https://你的项目域名/api/init/你的jwt_secret 进行数据库初始化。
  2. 自动同步上游可使用bot或者手动点击Sync Upstream按钮。

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/maillab/cloud-mail/pull/29 **Author:** [@Silentely](https://github.com/Silentely) **Created:** 7/7/2025 **Status:** ✅ Merged **Merged:** 7/7/2025 **Merged by:** [@eoao](https://github.com/eoao) **Base:** `dev` ← **Head:** `main` --- ### 📝 Commits (3) - [`4665ae9`](https://github.com/maillab/cloud-mail/commit/4665ae9b713c6422da7f9e63e2a1b7ef001327cc) 新增action部署 - [`986a533`](https://github.com/maillab/cloud-mail/commit/986a533e770469c4ee31c3be4b9e2662c453ae9c) fix action - [`7eeee4c`](https://github.com/maillab/cloud-mail/commit/7eeee4cc80135914d36dc64c4e21ae09bb7f007a) fix 变量说明 ### 📊 Changes **3 files changed** (+191 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `.github/workflows/deploy-cloudflare.yml` (+117 -0) 📝 `README.md` (+38 -0) ➕ `mail-worker/wrangler-action.toml` (+36 -0) </details> ### 📄 Description **本次更新引入了 GitHub Actions,实现了项目到 Cloudflare Workers 的自动化部署。这大大简化了部署流程,并提供了详细的部署指南。** ![7d491ef7f65fbb6bccb11e7455d11989](https://i.miji.bid/2025/07/07/7d491ef7f65fbb6bccb11e7455d11989.png) ![50b4a3438149d8624e589aa8a6ca635a](https://i.miji.bid/2025/07/07/50b4a3438149d8624e589aa8a6ca635a.png) ![2e5a54c5e227b7110ba461acc274529b](https://i.miji.bid/2025/07/07/2e5a54c5e227b7110ba461acc274529b.png) ### Github Action 部署 **配置 Github 仓库** 1. Fork 或克隆仓库 [https://github.com/eoao/cloud-mail](https://github.com/eoao/cloud-mail) 2. 进入您的 GitHub 仓库设置 3. 转到 Settings → Secrets and variables → Actions → New Repository secrets 4. 添加以下 Secrets: | Secret 名称 | 必需 | 用途 | | ----------------------- | :--: | ----------------------------------------------------- | | `CLOUDFLARE_API_TOKEN` | ✅ | Cloudflare API 令牌(需要 Workers 和相关资源权限) | | `CLOUDFLARE_ACCOUNT_ID` | ✅ | Cloudflare 账户 ID | | `D1_DATABASE_ID` | ✅ | 您的 D1 数据库的 ID | | `KV_NAMESPACE_ID` | ✅ | 您的 KV 命名空间的 ID | | `R2_BUCKET_NAME` | ✅ | 您的 R2 存储桶的名称 | | `DOMAIN` | ✅ | 您要用于邮件服务的域名(例如 `"["xx.xx"]",多域名用,分隔`) | | `ADMIN` | ✅ | 您的管理员邮箱地址(例如 `"admin@example.com"`) | | `JWT_SECRET` | ✅ | 用于生成和验证 JWT 的随机长字符串 | | `INIT_URL` | ❌ | (可选)部署后用于初始化数据库的 Worker URL | --- **获取 Cloudflare API 令牌** 1. 访问 [Cloudflare Dashboard](https://dash.cloudflare.com/profile/api-tokens) 2. 创建新的 API 令牌 3. 选择"编辑 Cloudflare Workers"模板,并参照下表添加相应权限 ![dc2e1dc8dcd217644759c46c6c705de1](https://i.miji.bid/2025/07/07/dc2e1dc8dcd217644759c46c6c705de1.png) 4. 保存令牌并复制到 GitHub Secrets 中的 `CLOUDFLARE_API_TOKEN` **获取 Cloudflare 账户 ID** 1. 账户 ID 可以在 Cloudflare 仪表盘的账户设置中找到。 2. 复制到 GitHub Secrets 中的 `CLOUDFLARE_ACCOUNT_ID` **运行工作流** 1. 然后在Action页面手手动运行工作流,后续同步上游后会自动部署到 Cloudflare Workers。如未配置 `INIT_URL`,则需要手动访问 `https://你的项目域名/api/init/你的jwt_secret` 进行数据库初始化。 2. 自动同步上游可使用bot或者手动点击Sync Upstream按钮。 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 09:13:39 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cloud-mail-maillab#185
No description provided.