Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 48 additions & 3 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
name: Package Agent Loop

on:
pull_request:
pull_request_target:
branches: [main]
types: [closed]

permissions:
contents: read

concurrency:
group: package-${{ github.event.pull_request.merge_commit_sha || github.run_id }}

env:
PACKAGE_NAME: agent-loop-pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.merge_commit_sha }}.tar.gz

jobs:
package:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
env:
PACKAGE_NAME: agent-loop-pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.merge_commit_sha }}.tar.gz
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down Expand Up @@ -57,3 +61,44 @@ jobs:
archive: false
if-no-files-found: error
overwrite: true

publish:
needs: package
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download verified package
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: ${{ env.PACKAGE_NAME }}
path: ${{ runner.temp }}

- name: Publish GitHub prerelease
shell: bash
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
tag="${PACKAGE_NAME%.tar.gz}"
package="$RUNNER_TEMP/$PACKAGE_NAME"
test -s "$package"

if release=$(gh release view "$tag" --json isDraft,assets); then
if jq -e '.isDraft == false' <<< "$release" >/dev/null; then
jq -e --arg name "$PACKAGE_NAME" \
'any(.assets[]; .name == $name and .state == "uploaded")' \
<<< "$release" >/dev/null
exit 0
fi
else
gh release create "$tag" --target "$MERGE_SHA" --draft --prerelease \
--title "Agent Loop build from PR #$PR_NUMBER" \
--notes "Verified package built from $PR_URL at commit $MERGE_SHA."
fi

gh release upload "$tag" "$package" --clobber
gh release edit "$tag" --draft=false
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Agent Loop 保存项目和任务的持续上下文。用户在项目协调群交

## 下载自动构建包

每个合入 `main` 的 PR 都会生成一个运行包。在对应运行记录的 **Artifacts** 下载 `agent-loop-pr-<PR 编号>-<提交 SHA>.tar.gz`。 [查看打包记录](https://github.com/mingtaojin/agent-loop/actions/workflows/package.yml)
每个合入 `main` 的 PR 都会生成一个运行包。运行包通过验证后会发布为预发行版。在 **Releases** 中打开对应 PR 的预发行版,从 **Assets** 下载 `agent-loop-pr-<PR 编号>-<提交 SHA>.tar.gz`。也可以从对应 Actions 运行的 **Artifacts** 下载。 [查看 Releases](https://github.com/mingtaojin/agent-loop/releases) · [查看打包记录](https://github.com/mingtaojin/agent-loop/actions/workflows/package.yml)

将包解压到新目录。运行包自带生产依赖。安装 Node.js 24、Git 和 Codex CLI 后,在解压出的 `agent-loop` 目录中复制示例配置。

Expand Down