Skip to content

Replace an existing release signature instead of failing - #67

Merged
ashirman merged 1 commit into
mainfrom
feature/rev-137
Oct 15, 2026
Merged

ashirman merged 1 commit into
mainfrom
feature/rev-137

Conversation

@revopushbot

Copy link
Copy Markdown
Contributor

Fixes REV-137.

Problem

sign() deletes a previous .codepushrelease before writing a new one, but it used fs.rmdir, which only removes folders. Signing an already signed folder always failed with ENOTDIR: not a directory, rmdir '…/.codepushrelease'.

release-react and release-expo empty the output folder before signing, so this didn't affect them today. It failed whenever sign() ran on a folder that was already signed.

Fix

  • sign.ts: delete the file with fs.rm(signatureFilePath, { force: true }). The "Deleting previous release signature" log line and the access-rights error stay as they were.
  • New test/sign.ts, which signs with a freshly generated RSA key and checks the result with the public key:
    • First signing: writes a valid signature whose contentHash equals generatePackageHashFromDirectory for the folder.
    • Signing the same folder again: replaces the signature, and the content hash is unchanged, which also shows the old signature was removed before hashing. This test failed with ENOTDIR before the fix.
    • A missing signing key: is rejected, and no signature file is written.

Verification

  • Build and lint: tsc, npm run lint and Prettier are clean.
  • Tests: all 158 pass on macOS and on Linux (Docker, Node 20.19.0).

🤖 Generated with Claude Code

sign() deleted the previous .codepushrelease with rmdir, which only removes
folders, so signing an already signed folder failed with ENOTDIR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ashirman
ashirman merged commit 41cc00f into main Oct 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants