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
2 changes: 1 addition & 1 deletion .github/workflows/codex-version-watch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ jobs:
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B "$branch" origin/main
node scripts/update-codex-candidate-manifest.js "$CANDIDATE_VERSION" "$candidate_state"
git add config/codex-termux-release-manifest.json
git add config/codex-termux-release-manifest.json packages/codex-termux/config/codex-termux-release-manifest.json
git commit -m "Track Codex ${CANDIDATE_VERSION} candidate"
git push --force-with-lease origin "$branch"
echo "branch=$branch" >> "$GITHUB_ENV"
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/promote-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ jobs:
- name: Publish guard check
run: node scripts/check-public-publish-guard.js --skip-runtime-files

- name: Verify previous_stable_version matches current npm latest
if: (inputs.npm_tag || 'latest') == 'latest'
run: |
set -eu
CURRENT_LATEST=$(npm view "@bash0816/codex-termux" dist-tags.latest 2>/dev/null || echo "")
PREV=$(node -p "JSON.parse(require('fs').readFileSync('config/codex-termux-release-manifest.json','utf8')).previous_stable_version")
if [ "$CURRENT_LATEST" != "$PREV" ]; then
echo "ERROR: previous_stable_version ($PREV) does not match npm registry latest ($CURRENT_LATEST). Fix config/codex-termux-release-manifest.json before promoting." >&2
exit 1
fi
echo "previous_stable_version ($PREV) matches npm latest ($CURRENT_LATEST), OK"

- name: Promote dist-tag
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion config/codex-termux-release-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"support_status": "active",
"latest_audited_version": "0.144.4",
"latest_candidate_version": "0.144.5",
"previous_stable_version": "0.144.3",
"previous_stable_version": "0.144.4",
"candidate_state": "published",
"candidate_state_status": "ready_to_publish",
"audit_evidence_ref": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"public_distribution_status": "published",
"support_status": "active",
"latest_audited_version": "0.144.4",
"latest_candidate_version": "0.144.4",
"previous_stable_version": "0.144.3",
"latest_candidate_version": "0.144.5",
"previous_stable_version": "0.144.4",
"candidate_state": "published",
"candidate_state_status": "ready_to_publish",
"tracked_versions": [
Expand Down
85 changes: 70 additions & 15 deletions scripts/update-codex-candidate-manifest.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,80 @@
const fs = require('fs');
const path = require('path');

const repoRoot = path.resolve(__dirname, '..');
const manifestPath = path.join(repoRoot, 'config', 'codex-termux-release-manifest.json');
/**
* Update both root and package manifests with candidate version and state.
* Ensures updated_at timestamp is identical in both files.
*
* @param {Object} opts
* @param {string} opts.rootPath - path to root manifest
* @param {string} opts.packagePath - path to package manifest
* @param {string} opts.candidateVersion - new latest_candidate_version
* @param {string} opts.candidateState - new candidate_state_status
*/
function updateManifests({
rootPath,
packagePath,
candidateVersion,
candidateState,
}) {
if (!rootPath || !packagePath || !candidateVersion || !candidateState) {
throw new Error('All parameters (rootPath, packagePath, candidateVersion, candidateState) are required');
}

function usage() {
console.error('usage: node scripts/update-codex-candidate-manifest.js <candidate-version> <candidate-state>');
process.exit(2);
}
// Generate timestamp once, use for both files
const updatedAt = new Date().toISOString();

const candidateVersion = process.argv[2];
const candidateState = process.argv[3];
// Update root manifest
const rootManifest = JSON.parse(fs.readFileSync(rootPath, 'utf8'));
rootManifest.latest_candidate_version = candidateVersion;
rootManifest.candidate_state_status = candidateState;
rootManifest.updated_at = updatedAt;
Comment on lines +29 to +31

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Set previous_stable_version during new intake

When the next candidate is ingested after this release finalizes, scripts/finalize-update-docs.sh only advances latest_audited_version and leaves previous_stable_version at the prior value; this function then starts the new candidate without deriving previous_stable_version from the current audited/latest version. The new guard in .github/workflows/promote-and-publish.yml compares that stale field to npm latest, so promoting the following release (for example 0.144.6 after 0.144.5 is latest) will fail until the manifest is manually edited. Please update previous_stable_version for both manifests when starting a new candidate, or move that maintenance into finalization.

Useful? React with 👍 / 👎.

fs.writeFileSync(rootPath, `${JSON.stringify(rootManifest, null, 2)}\n`);

if (!candidateVersion || !candidateState) {
usage();
// Update package manifest
// Read existing package manifest to preserve distribution-specific fields
const packageManifest = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
packageManifest.latest_candidate_version = candidateVersion;
packageManifest.candidate_state_status = candidateState;
packageManifest.updated_at = updatedAt;
fs.writeFileSync(packagePath, `${JSON.stringify(packageManifest, null, 2)}\n`);
}

const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
manifest.latest_candidate_version = candidateVersion;
manifest.candidate_state_status = candidateState;
manifest.updated_at = new Date().toISOString();
// CLI interface
if (require.main === module) {
const repoRoot = path.resolve(__dirname, '..');
const rootManifestPath = path.join(repoRoot, 'config', 'codex-termux-release-manifest.json');
const packageManifestPath = path.join(
repoRoot,
'packages',
'codex-termux',
'config',
'codex-termux-release-manifest.json'
);

function usage() {
console.error('usage: node scripts/update-codex-candidate-manifest.js <candidate-version> <candidate-state>');
process.exit(2);
}

const candidateVersion = process.argv[2];
const candidateState = process.argv[3];

fs.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
if (!candidateVersion || !candidateState) {
usage();
}

try {
updateManifests({
rootPath: rootManifestPath,
packagePath: packageManifestPath,
candidateVersion,
candidateState,
});
} catch (err) {
console.error('Error updating manifests:', err.message);
process.exit(1);
}
}

module.exports = { updateManifests };
Loading
Loading