-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
111 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,17 +12,118 @@ | |
|
||
## 一键部署 | ||
|
||
只需点击下面的按钮,即可将此项目部署到您的 Cloudflare Workers 账户: | ||
以下是根据您提供的大意,以 Markdown 格式完善的部署流程说明: | ||
|
||
|
||
## GitHub Actions 部署流程 | ||
|
||
### 0. Cloudflare 准备工作 | ||
|
||
- 注册并登录 Cloudflare 账户。 | ||
- 创建一个 R2 存储桶,并记下桶的名称。 | ||
- 创建一个 Worker API token(确保具有编辑 Cloudflare Workers 的权限),并保存 API 令牌。 | ||
|
||
[](https://deploy.workers.cloudflare.com/?url=https://github.com/aigem/r2-webdav-s3) | ||
|
||
部署步骤: | ||
1. 点击上面的按钮 | ||
2. 如果尚未登录,请登录您的 Cloudflare 账户 | ||
3. 选择一个 Worker 名称和要部署到的账户 | ||
4. 点击"部署" | ||
|
||
注意:部署后,您可能需要在 Cloudflare 控制面板中设置一些环境变量或密钥。 | ||
### 1. Fork 仓库 | ||
|
||
- 访问 [https://github.com/aigem/r2-webdav-s3](https://github.com/aigem/r2-webdav-s3) | ||
- 点击页面右上角的 "Fork" 按钮,将仓库 fork 到您的 GitHub 账户。 | ||
|
||
### 2. 设置 GitHub Secrets | ||
|
||
在您 fork 的仓库中,导航到 Settings -> Secrets and variables -> Actions,然后添加以下 secrets: | ||
|
||
- `CLOUDFLARE_API_TOKEN`: Cloudflare 的 API Token | ||
- `USERNAME`: WebDAV 的用户名 | ||
- `PASSWORD`: WebDAV 的密码 | ||
- `my_bucket`: R2 存储桶的名称 | ||
- `ACCESS_KEY_ID`: S3 的访问密钥 ID(如果使用 S3) | ||
- `SECRET_ACCESS_KEY`: S3 的访问密钥(如果使用 S3) | ||
|
||
### 3. 创建 GitHub Action | ||
|
||
- 在您 fork 的仓库中,点击 "Actions" 标签。 | ||
- 点击 "New workflow" 或 "set up a workflow yourself"。 | ||
- 将文件命名为 `deploy.yml`(或您喜欢的任何名称)。 | ||
|
||
### 4. 配置工作流文件 | ||
|
||
将以下内容粘贴到工作流文件中: | ||
|
||
```yaml | ||
name: Deploy to Cloudflare Workers | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # 或者您想触发部署的分支 | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
name: Deploy | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20.x' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Create wrangler.toml | ||
run: | | ||
echo "name = \"r2-webdav-s3\"" > wrangler.toml | ||
echo "main = \"src/index.ts\"" >> wrangler.toml | ||
echo "compatibility_date = \"2023-01-01\"" >> wrangler.toml | ||
echo "" >> wrangler.toml | ||
echo "[vars]" >> wrangler.toml | ||
echo "USERNAME = \"${{ secrets.USERNAME }}\"" >> wrangler.toml | ||
echo "PASSWORD = \"${{ secrets.PASSWORD }}\"" >> wrangler.toml | ||
echo "" >> wrangler.toml | ||
echo "[[r2_buckets]]" >> wrangler.toml | ||
echo "binding = \"bucket\"" >> wrangler.toml | ||
echo "bucket_name = \"${{ secrets.my_bucket }}\"" >> wrangler.toml | ||
echo "" >> wrangler.toml | ||
echo "[vars.S3]" >> wrangler.toml | ||
echo "ENDPOINT = \"your_s3_endpoint\"" >> wrangler.toml | ||
echo "REGION = \"auto\"" >> wrangler.toml | ||
echo "ACCESS_KEY_ID = \"${{ secrets.ACCESS_KEY_ID }}\"" >> wrangler.toml | ||
echo "SECRET_ACCESS_KEY = \"${{ secrets.SECRET_ACCESS_KEY }}\"" >> wrangler.toml | ||
echo "BUCKET = \"${{ secrets.my_bucket }}\"" >> wrangler.toml | ||
- name: Publish to Cloudflare Workers | ||
uses: cloudflare/[email protected] | ||
with: | ||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
``` | ||
### 5. 提交并推送更改 | ||
- 点击 "Start commit" 或 "Commit changes"。 | ||
- 添加提交消息(例如 "Add deployment workflow")。 | ||
- 选择 "Commit directly to the main branch"。 | ||
- 点击 "Commit new file"。 | ||
### 6. 触发部署 | ||
- 对仓库进行任何更改并推送到 `main` 分支(或您在工作流中指定的分支)。 | ||
- 这将自动触发部署过程。 | ||
|
||
### 7. 查看部署状态 | ||
|
||
- 在仓库中,点击 "Actions" 标签。 | ||
- 您应该能看到正在运行或已完成的工作流。 | ||
- 点击工作流以查看详细的部署日志。 | ||
|
||
### 8. 访问您的 Cloudflare Worker | ||
|
||
部署成功后,您可以在 Cloudflare 控制面板中找到您的 Worker URL。使用这个 URL 来访问您的 WebDAV 和 S3 兼容服务器。 | ||
|
||
|
||
|
||
这个 Markdown 格式的说明提供了详细的步骤指导,从 Cloudflare 的准备工作到 GitHub Actions 的配置和部署过程。您可以直接将这段内容添加到您的 `README.md` 文件中。 | ||
|
||
## 本地设置 | ||
|
||
|