Multi target release #6

Open
opened 2026-11-21 11:45:30 +01:00 by Dandaedre · 1 comment
Owner
  • Support github endpoint

  • Support multiple endpoints

- [ ] Support github endpoint - [ ] Support multiple endpoints
Author
Owner

Problem

rust_realease currently creates, uploads, and verifies a release only on the
canonical Gitea repository. Idle now mirrors selected repositories to GitHub, but
Git tags do not carry release notes or release assets. A one-time migration copied
17 releases and 161 assets (2.84 GB), which shows that future releases need a
first-class, repeatable dual-publication path.

Required behavior

Add an opt-in publication target that sends the same prepared release to both
Gitea and GitHub without rebuilding or repackaging artifacts.

  1. Build and package once. Reuse the exact release notes, prerelease/draft state,
    artifact bytes, filenames, labels, manifest, and checksum files for both hosts.

  2. Keep Gitea-only publication fully compatible. Existing commands, configuration,
    --token-file, and GITEA_TOKEN must retain their current behavior.

  3. Use explicit, independent credentials:

    • --gitea-token-file PATH and --github-token-file PATH;
    • keep --token-file PATH as a documented backward-compatible alias for
      --gitea-token-file;
    • support independent gitea.token-env and github.token-env settings,
      defaulting to GITEA_TOKEN and GITHUB_TOKEN;
    • reject conflicting aliases and reject empty or multiline token files using
      the existing token-file validation;
    • do not introduce a combined two-token file format. Separate files allow
      independent permissions, rotation, expiry, and secret handling.
  4. Require an explicit GitHub destination, for example:

    [github]
    repository = "https://github.com/idle-org/pdf-presenter"
    token-env = "GITHUB_TOKEN"
    

    A matching CLI override such as --github-repository-url is acceptable. Do
    not infer the GitHub owner/repository from the Gitea URL.

  5. Before mutation, verify that the release tag exists on both repositories and
    resolves to the same commit (including annotated-tag peeling). Refuse a tag or
    repository mismatch.

  6. Make publication resumable and idempotent per destination:

    • reuse a matching release by tag;
    • refuse metadata or asset collisions with different content unless the user
      explicitly requested the existing replacement behavior;
    • skip assets already present with the expected name, size, and digest;
    • after a partial failure, a rerun must finish the incomplete destination
      without rebuilding or corrupting the completed one;
    • never delete unrelated assets.
  7. Upload as drafts where supported, verify every uploaded byte, then publish.
    Preserve release title, notes, prerelease state, and deliberate draft behavior.
    GitHub's make_latest behavior must not let a prerelease replace the latest
    stable release.

  8. Verify each destination independently:

    • asset set, size, and SHA-256 digest;
    • SHA256SUMS entries where present;
    • anonymous downloads for public repositories;
    • existing cargo-binstall verification remains valid against the configured
      public download source.
  9. Report a clear result matrix (Gitea / GitHub: created, resumed, verified,
    failed). A failure on one host must return nonzero and identify that host while
    preserving the successfully verified release on the other host.

Security constraints

  • Never print, serialize, cache, or place either token in a URL.
  • Do not pass either token to Cargo, Cross, Git, or unrelated child processes.
  • Send the GitHub token only to api.github.com and uploads.github.com, after
    validating the request host; follow downloads anonymously when the repository is
    public.
  • Document the minimum fine-grained GitHub permission: selected repository,
    Contents: read and write. No organization administration permission is needed.
  • Retain HTTPS-only authenticated API publication and current diagnostic redaction.

Design boundary

Introduce a small release-host interface only where it removes the current Gitea
coupling in release creation, upload, and verification. Keep build, packaging,
artifact discovery, checksum generation, and cargo-binstall logic host-independent.
Do not turn this task into a general forge plugin system, release polling service,
webhook receiver, or historical migration command.

Tests and acceptance

  • Unit tests for CLI/config precedence, alias conflicts, token isolation/redaction,
    URL/host validation, tag comparison, release metadata conversion, and GitHub API
    error handling.
  • HTTP fixture tests for fresh dual publication, existing matching releases,
    partial resume, different-content collision, replacement, draft/prerelease state,
    upload failure on either host, digest mismatch, and retry after interruption.
  • A test proves both hosts receive byte-identical artifacts from one package stage.
  • A test proves Gitea-only invocation and its existing flags remain unchanged.
  • Documentation updates for quick start, advanced authentication, configuration,
    failure semantics, token rotation, and the self-release procedure.
  • Final validation: formatting, warnings-denied Clippy, locked tests, and the
    repository's 80% coverage floor.
  • Live acceptance uses a disposable repository on each forge and a new tag. Verify
    release notes, status, every asset digest, anonymous download, and isolated
    cargo-binstall installation. Do not alter an existing production release during
    acceptance.

Example invocation

rust_realease . --package pdf-presenter --prerelease \
  --gitea-token-file ../gitea-token.txt \
  --github-token-file ../github-release-token.txt

The normal dry run should describe both destinations and required credentials
without reading or displaying the token values.

## Problem `rust_realease` currently creates, uploads, and verifies a release only on the canonical Gitea repository. Idle now mirrors selected repositories to GitHub, but Git tags do not carry release notes or release assets. A one-time migration copied 17 releases and 161 assets (2.84 GB), which shows that future releases need a first-class, repeatable dual-publication path. ## Required behavior Add an opt-in publication target that sends the same prepared release to both Gitea and GitHub without rebuilding or repackaging artifacts. 1. Build and package once. Reuse the exact release notes, prerelease/draft state, artifact bytes, filenames, labels, manifest, and checksum files for both hosts. 2. Keep Gitea-only publication fully compatible. Existing commands, configuration, `--token-file`, and `GITEA_TOKEN` must retain their current behavior. 3. Use explicit, independent credentials: - `--gitea-token-file PATH` and `--github-token-file PATH`; - keep `--token-file PATH` as a documented backward-compatible alias for `--gitea-token-file`; - support independent `gitea.token-env` and `github.token-env` settings, defaulting to `GITEA_TOKEN` and `GITHUB_TOKEN`; - reject conflicting aliases and reject empty or multiline token files using the existing token-file validation; - do not introduce a combined two-token file format. Separate files allow independent permissions, rotation, expiry, and secret handling. 4. Require an explicit GitHub destination, for example: ```toml [github] repository = "https://github.com/idle-org/pdf-presenter" token-env = "GITHUB_TOKEN" ``` A matching CLI override such as `--github-repository-url` is acceptable. Do not infer the GitHub owner/repository from the Gitea URL. 5. Before mutation, verify that the release tag exists on both repositories and resolves to the same commit (including annotated-tag peeling). Refuse a tag or repository mismatch. 6. Make publication resumable and idempotent per destination: - reuse a matching release by tag; - refuse metadata or asset collisions with different content unless the user explicitly requested the existing replacement behavior; - skip assets already present with the expected name, size, and digest; - after a partial failure, a rerun must finish the incomplete destination without rebuilding or corrupting the completed one; - never delete unrelated assets. 7. Upload as drafts where supported, verify every uploaded byte, then publish. Preserve release title, notes, prerelease state, and deliberate draft behavior. GitHub's `make_latest` behavior must not let a prerelease replace the latest stable release. 8. Verify each destination independently: - asset set, size, and SHA-256 digest; - `SHA256SUMS` entries where present; - anonymous downloads for public repositories; - existing cargo-binstall verification remains valid against the configured public download source. 9. Report a clear result matrix (`Gitea` / `GitHub`: created, resumed, verified, failed). A failure on one host must return nonzero and identify that host while preserving the successfully verified release on the other host. ## Security constraints - Never print, serialize, cache, or place either token in a URL. - Do not pass either token to Cargo, Cross, Git, or unrelated child processes. - Send the GitHub token only to `api.github.com` and `uploads.github.com`, after validating the request host; follow downloads anonymously when the repository is public. - Document the minimum fine-grained GitHub permission: selected repository, **Contents: read and write**. No organization administration permission is needed. - Retain HTTPS-only authenticated API publication and current diagnostic redaction. ## Design boundary Introduce a small release-host interface only where it removes the current Gitea coupling in release creation, upload, and verification. Keep build, packaging, artifact discovery, checksum generation, and cargo-binstall logic host-independent. Do not turn this task into a general forge plugin system, release polling service, webhook receiver, or historical migration command. ## Tests and acceptance - Unit tests for CLI/config precedence, alias conflicts, token isolation/redaction, URL/host validation, tag comparison, release metadata conversion, and GitHub API error handling. - HTTP fixture tests for fresh dual publication, existing matching releases, partial resume, different-content collision, replacement, draft/prerelease state, upload failure on either host, digest mismatch, and retry after interruption. - A test proves both hosts receive byte-identical artifacts from one package stage. - A test proves Gitea-only invocation and its existing flags remain unchanged. - Documentation updates for quick start, advanced authentication, configuration, failure semantics, token rotation, and the self-release procedure. - Final validation: formatting, warnings-denied Clippy, locked tests, and the repository's 80% coverage floor. - Live acceptance uses a disposable repository on each forge and a new tag. Verify release notes, status, every asset digest, anonymous download, and isolated cargo-binstall installation. Do not alter an existing production release during acceptance. ## Example invocation ```bash rust_realease . --package pdf-presenter --prerelease \ --gitea-token-file ../gitea-token.txt \ --github-token-file ../github-release-token.txt ``` The normal dry run should describe both destinations and required credentials without reading or displaying the token values.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: idle-org/rust_realease#6
No description provided.