Create sync.yml #1
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: Package Worker # 工作流程的名称 | |
on: # 触发事件 | |
workflow_dispatch: # 手动触发 | |
push: # 当代码被推送到仓库时触发 | |
paths: # 指定触发条件的文件路径 | |
- '_worker.js' # 当_worker.js文件发生变动时触发 | |
jobs: # 工作流程中的任务 | |
package-and-commit: # 任务名称 | |
runs-on: ubuntu-latest # 运行环境,这里使用最新版本的Ubuntu | |
steps: # 任务步骤 | |
- name: Checkout Repository # 步骤名称,检出代码 | |
uses: actions/checkout@v2 # 使用actions/checkout动作 | |
- name: Zip the worker file # 将_worker.js文件打包成worker.zip | |
run: zip worker.zip _worker.js # 使用zip命令直接打包 | |
- name: Commit and push the packaged file # 提交并推送打包后的文件 | |
uses: EndBug/add-and-commit@v7 # 使用EndBug/add-and-commit动作 | |
with: | |
add: 'worker.zip' # 指定要提交的文件 | |
message: 'Automatically package and commit worker.zip' # 提交信息 | |
author_name: github-actions[bot] # 提交者名称 | |
author_email: actions[bot]@users.noreply.github.com # 提交者邮箱 | |
token: ${{ secrets.GH_TOKEN }} # 使用GH_TOKEN作为身份验证 |