ci(release): ensure unique npm version across packages; idempotent publish steps; bump codex-cli to 0.2.62

This commit is contained in:
James Peter
2025-09-05 21:47:50 +10:00
parent 74fda941ba
commit 592b3f65e9
4 changed files with 73 additions and 38 deletions
+19 -20
View File
@@ -5,7 +5,7 @@ on:
types: [opened, reopened]
concurrency:
group: issue-autopilot-${{ github.event.issue.number }}
group: issue-triage-${{ github.event.issue.number }}
cancel-in-progress: true
permissions:
@@ -14,7 +14,7 @@ permissions:
issues: write
jobs:
issue_autopilot:
issue_triage:
runs-on: ubuntu-latest
env:
@@ -78,37 +78,36 @@ jobs:
- Be concise. Avoid touching unrelated files. Fix any compiler warnings you introduce.
EOF
- name: Run Code agent to implement or respond (published package)
- name: Run Code agent to implement or respond
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
shell: bash
run: |
set -euo pipefail
if [ -z "${OPENAI_API_KEY:-}" ]; then
echo "OPENAI_API_KEY secret is required for issue autopilot." >&2
echo "OPENAI_API_KEY secret is required for issue triage." >&2
exit 1
fi
PROMPT=$(cat << 'EOP'
/plan
- Understand the issue and list exact edits needed (paths, snippets).
- If edits are warranted, make them and ensure the repo still builds locally if applicable (use ./build-fast.sh).
- If no edits are warranted, prepare a high-signal maintainer comment.
<task>
- Understand the issue and list exact edits needed (paths, snippets).
- If edits are warranted, make them and ensure the repo still builds locally if applicable (use ./build-fast.sh).
- If no edits are warranted, prepare a high-signal maintainer comment.
</task>
/solve
<context>
Repository: ${{ env.REPO }}
Default branch: ${{ env.DEFAULT_BRANCH }}
Issue #${{ env.ISSUE_NUMBER }}: ${{ env.ISSUE_TITLE }}
Context
--------
Repository: ${{ env.REPO }}
Default branch: ${{ env.DEFAULT_BRANCH }}
Issue #${{ env.ISSUE_NUMBER }}: ${{ env.ISSUE_TITLE }}
Issue body:
${{ env.ISSUE_BODY }}
Issue body:
${{ env.ISSUE_BODY }}
Actor: ${{ env.ACTOR }}
Actor: ${{ env.ACTOR }}
Instructions:
$(cat .github/auto/CONTEXT.md)
Instructions:
$(cat .github/auto/CONTEXT.md)
</context>
EOP
)
printf '%s' "$PROMPT" | npx -y @just-every/code@latest exec \
+44 -11
View File
@@ -38,7 +38,7 @@ jobs:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Determine next version (across all npm packages)
- name: Determine next version (across all npm packages; ensure unique)
id: version
working-directory: codex-cli
shell: bash
@@ -53,19 +53,32 @@ jobs:
"@just-every/code-linux-arm64-musl"
"@just-every/code-win32-x64"
)
VERS=("$CURRENT_VERSION")
# Find the highest published version across all packages
MAX_PUBLISHED="0.0.0"
for p in "${PKGS[@]}"; do
v=$(npm view "$p" version 2>/dev/null || echo "0.0.0")
VERS+=("$v")
if [ "$(printf '%s\n%s\n' "$MAX_PUBLISHED" "$v" | sort -V | tail -n1)" != "$MAX_PUBLISHED" ]; then
MAX_PUBLISHED="$v"
fi
done
MAX_PUBLISHED=$(printf '%s\n' "${VERS[@]}" | sort -V | tail -n1)
# If our current version is <= max published, bump the patch of max.
if [ "$CURRENT_VERSION" = "$MAX_PUBLISHED" ] || [ "$CURRENT_VERSION" \< "$MAX_PUBLISHED" ]; then
IFS='.' read -ra V <<< "$MAX_PUBLISHED"
NEW_VERSION="${V[0]}.${V[1]}.$((${V[2]} + 1))"
else
NEW_VERSION=$CURRENT_VERSION
# Start with whichever is higher: CURRENT_VERSION or MAX_PUBLISHED
CANDIDATE=$(printf '%s\n%s\n' "$CURRENT_VERSION" "$MAX_PUBLISHED" | sort -V | tail -n1)
# If equal to MAX_PUBLISHED, bump patch once
if [ "$CANDIDATE" = "$MAX_PUBLISHED" ]; then
IFS='.' read -ra V <<< "$CANDIDATE"; CANDIDATE="${V[0]}.${V[1]}.$((${V[2]} + 1))"
fi
# Ensure candidate is globally unused; keep bumping until unique
while :; do
used=false
for p in "${PKGS[@]}"; do
if [ "$(npm view "$p@$CANDIDATE" version 2>/dev/null || true)" = "$CANDIDATE" ]; then
used=true; break
fi
done
if [ "$used" = false ]; then break; fi
IFS='.' read -ra V <<< "$CANDIDATE"; CANDIDATE="${V[0]}.${V[1]}.$((${V[2]} + 1))"
done
NEW_VERSION="$CANDIDATE"
echo "version=${NEW_VERSION}" >> "$GITHUB_OUTPUT"
build-binaries:
@@ -668,7 +681,16 @@ jobs:
shell: bash
run: |
set -euo pipefail
shopt -s nullglob
for dir in npm-binaries/*; do
name=$(jq -r '.name' "$dir/package.json")
version=$(jq -r '.version' "$dir/package.json")
echo "Preparing to publish $name@$version"
existing=$(npm view "$name@$version" version 2>/dev/null || true)
if [ "$existing" = "$version" ]; then
echo "Skip: $name@$version already published"
continue
fi
echo "Publishing $(basename \"$dir\")"
(cd "$dir" && npm publish --access public)
done
@@ -678,4 +700,15 @@ jobs:
working-directory: codex-cli
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public
shell: bash
run: |
set -euo pipefail
name="@just-every/code"
version=$(jq -r '.version' package.json)
echo "Preparing to publish $name@$version"
existing=$(npm view "$name@$version" version 2>/dev/null || true)
if [ "$existing" = "$version" ]; then
echo "Skip: $name@$version already published"
exit 0
fi
npm publish --access public
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@just-every/code",
"version": "0.2.60",
"version": "0.2.62",
"license": "Apache-2.0",
"description": "Lightweight coding agent that runs in your terminal - fork of OpenAI Codex",
"bin": {
@@ -32,10 +32,10 @@
"prettier": "^3.3.3"
},
"optionalDependencies": {
"@just-every/code-darwin-arm64": "0.2.60",
"@just-every/code-darwin-x64": "0.2.60",
"@just-every/code-linux-x64-musl": "0.2.60",
"@just-every/code-linux-arm64-musl": "0.2.60",
"@just-every/code-win32-x64": "0.2.60"
"@just-every/code-darwin-arm64": "0.2.62",
"@just-every/code-darwin-x64": "0.2.62",
"@just-every/code-linux-x64-musl": "0.2.62",
"@just-every/code-linux-arm64-musl": "0.2.62",
"@just-every/code-win32-x64": "0.2.62"
}
}
+4 -1
View File
@@ -129,7 +129,10 @@ fn strip_specials(input: String, mode: Mode) -> String {
}
}
}
c if (c as u32) < 0x20 || c == '\u{007F}' => { /* drop C0 */ }
// Preserve newlines for layout; tabs must never be re-emitted
// here (they should have been expanded earlier).
'\n' => out.push('\n'),
c if (c as u32) < 0x20 || c == '\u{007F}' => { /* drop other C0 */ }
c if is_c1(c) => { /* drop C1 */ }
c if is_zero_width_or_bidi(c) => { /* drop zero-width/bidi */ }
_ => out.push(ch),