-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (120 loc) · 4.94 KB
/
Copy pathpublish.yml
File metadata and controls
125 lines (120 loc) · 4.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Publish to npm
on:
push:
tags: ['v*']
concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
env:
OPENCLAW_SCHEDULER_REF: dbd353e9eef4342fe4b5cdeb63e2ffa2006a5119
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: Verify tagged commit is contained in main
run: |
git fetch --no-tags origin '+refs/heads/main:refs/remotes/origin/main'
TAG_COMMIT="$(git rev-list -n 1 "$GITHUB_REF_NAME")"
if ! git merge-base --is-ancestor "$TAG_COMMIT" refs/remotes/origin/main; then
echo "Tag $GITHUB_REF_NAME points to $TAG_COMMIT, which is not contained in origin/main"
exit 1
fi
- name: Check out pinned openclaw-scheduler
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: amittell/openclaw-scheduler
ref: dbd353e9eef4342fe4b5cdeb63e2ffa2006a5119
path: openclaw-scheduler
- name: Configure scheduler fixture path
run: echo "SCHEDULER_PATH=$RUNNER_TEMP/openclaw-scheduler" >> "$GITHUB_ENV"
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '24'
cache: npm
cache-dependency-path: |
package-lock.json
openclaw-scheduler/package-lock.json
- name: Move scheduler fixture outside the agentcli source tree
run: mv openclaw-scheduler "$SCHEDULER_PATH"
- run: npm ci
- name: Install and verify pinned scheduler runtime
run: |
cd "$SCHEDULER_PATH"
test "$(git rev-parse HEAD)" = "$OPENCLAW_SCHEDULER_REF"
npm ci
node bin/openclaw-scheduler.js --json capabilities > /dev/null
- run: npm run lint
- run: npm test
- name: Verify shared handoff v4 fixture parity
run: cmp fixtures/handoff-v4/conformance.json "$SCHEDULER_PATH/fixtures/handoff-v4/conformance.json"
- run: npm run verify:package
publish:
needs: test
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
id-token: write
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: Verify tagged commit is contained in main
run: |
git fetch --no-tags origin '+refs/heads/main:refs/remotes/origin/main'
TAG_COMMIT="$(git rev-list -n 1 "$GITHUB_REF_NAME")"
if ! git merge-base --is-ancestor "$TAG_COMMIT" refs/remotes/origin/main; then
echo "Tag $GITHUB_REF_NAME points to $TAG_COMMIT, which is not contained in origin/main"
exit 1
fi
- name: Require successful main CI for tagged commit
env:
GH_TOKEN: ${{ github.token }}
run: |
tag_commit="$(git rev-list -n 1 "$GITHUB_REF_NAME")"
deadline=$((SECONDS + 1800))
while [ "$SECONDS" -lt "$deadline" ]; do
run_json="$(gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/ci.yml/runs?event=push&head_sha=${tag_commit}&per_page=20")"
status="$(printf '%s' "$run_json" | jq -r '[.workflow_runs[] | select(.head_branch == "main")] | sort_by(.run_number) | last | .status // "missing"')"
conclusion="$(printf '%s' "$run_json" | jq -r '[.workflow_runs[] | select(.head_branch == "main")] | sort_by(.run_number) | last | .conclusion // "pending"')"
if [ "$status" = "completed" ] && [ "$conclusion" = "success" ]; then
exit 0
fi
if [ "$status" = "completed" ] && [ "$conclusion" != "success" ]; then
echo "Main CI for $tag_commit completed with conclusion $conclusion"
exit 1
fi
sleep 10
done
echo "Timed out waiting for successful main CI for $tag_commit"
exit 1
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '24'
cache: npm
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run verify:package
- name: Verify tag matches package.json version
env:
TAG_REF: ${{ github.ref_name }}
run: |
TAG_VERSION="${TAG_REF#v}"
PKG_VERSION=$(node -p "require('./package.json').version")
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "Tag $TAG_VERSION does not match package.json version $PKG_VERSION"
exit 1
fi
- run: npm publish --provenance --access public
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
TAG_REF: ${{ github.ref_name }}
run: gh release create "$TAG_REF" --generate-notes