release: v0.1.0-beta.1 prep with CI lanes, artifact and release procedure
- version 0.1.0-beta.1 in Cargo.toml/tool.json - Woodpecker CI: Rust gates + tool packaging on push/tag; manual clean-container real-CLI contract lane - docs/RELEASE.md: beta scope, credentials policy, CI coverage, remaining work, artifact identity and SHA-256 of the tool bundle - scripts/release-beta.sh: committed release driver (tag/push/CI activation/ Gitea prerelease) using local-only environment credentials - CHANGELOG.md; README beta banner; STATUS records the post-bump acceptance run - dist/ ignored; no secrets staged (verified)
This commit is contained in:
1 parent
add8ccada1
commit
1a5e21eab2
11 files changed
+446
-6
No files matched your search
@@ -1,4 +1,8 @@
|
||||
# LOCAL ONLY release/CI credentials — never commit
|
||||
/.secrets/
|
||||
|
||||
# Rust build output
|
||||
/dist/
|
||||
/target/
|
||||
|
||||
# Local development toolchain and scratch space (not part of the deliverable)
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# Manual contract lane: builds the real Marqdo CLI at its pinned release and
|
||||
# runs Prove's real-CLI contract tests against it. This complements the local
|
||||
# evidence recorded in docs/STATUS.md: it proves the Analysis revision 3
|
||||
# integration still works in a clean CI container.
|
||||
when:
|
||||
event: [manual]
|
||||
|
||||
steps:
|
||||
contract:
|
||||
image: rust:1.100-bookworm
|
||||
commands:
|
||||
- apt-get update
|
||||
- apt-get install -y --no-install-recommends git ca-certificates
|
||||
- git clone --depth 1 https://git.cflmy.cn/cflmy/marqdo-cli /tmp/marqdo-cli
|
||||
- cargo build --release --locked --manifest-path /tmp/marqdo-cli/Cargo.toml -p marqdo-cli
|
||||
- /tmp/marqdo-cli/target/release/marqdo --version
|
||||
- cargo test --locked --test analysis_document --test document_contract
|
||||
environment:
|
||||
MARQDO_BIN: /tmp/marqdo-cli/target/release/marqdo
|
||||
@@ -0,0 +1,32 @@
|
||||
# Woodpecker CI for marqdo-prove (beta lane).
|
||||
#
|
||||
# The shared docker runner can execute the Rust-side gates and package the
|
||||
# tool bundle. The Lean-backed acceptance suite needs the pinned Lean 4.36 +
|
||||
# Mathlib environment (~7.5 GiB of oleans) and therefore runs on a dedicated
|
||||
# runner, not on this shared lane; see docs/RELEASE.md.
|
||||
when:
|
||||
event: [push, pull_request, tag]
|
||||
|
||||
steps:
|
||||
test:
|
||||
image: rust:1.100-bookworm
|
||||
commands:
|
||||
- rustup component add clippy rustfmt
|
||||
- cargo fmt --all -- --check
|
||||
- cargo clippy --all-targets -- -D warnings
|
||||
- cargo test --locked
|
||||
- cargo build --release --locked
|
||||
- ./target/release/marqdo-prove --version
|
||||
|
||||
package:
|
||||
image: rust:1.100-bookworm
|
||||
commands:
|
||||
- cargo build --release --locked
|
||||
- ./scripts/package-tool.sh dist/marqdo-prove-tool
|
||||
- ./target/release/marqdo-prove --version
|
||||
- tar -czf "marqdo-prove-${CI_COMMIT_TAG:-dev}-x86_64-unknown-linux-gnu-tool.tar.gz" -C dist marqdo-prove-tool
|
||||
- sha256sum "marqdo-prove-${CI_COMMIT_TAG:-dev}-x86_64-unknown-linux-gnu-tool.tar.gz" > SHA256SUMS
|
||||
- cat SHA256SUMS
|
||||
when:
|
||||
- event: [tag]
|
||||
- event: [push, pull_request]
|
||||
@@ -0,0 +1,56 @@
|
||||
# Changelog
|
||||
|
||||
## v0.1.0-beta.1 — beta of the first release (2026-11-26)
|
||||
|
||||
First **beta**. The proof pipeline is real and end-to-end on the recorded
|
||||
environment, but the full release gates from `docs/DEVELOPMENT.md` §13–§14 are
|
||||
not all satisfied. Treat this as an evaluated preview, not a stable release.
|
||||
|
||||
### Added
|
||||
|
||||
- `marqdo-prove check ENTRY` and `marqdo-prove replay ENTRY BUNDLE`.
|
||||
- Real upstream integration: strict `marqdo.analysis` revision 3 consumption
|
||||
from `check --emit`; no raw-Markdown parsing, no compatibility reader.
|
||||
- Proof-unit selection (Knowledge H2 + direct `### 证明依赖` + one direct
|
||||
display math goal), exact Markdown link resolution inside a controlled root,
|
||||
dependency DAG with cycle chains, and program-model alias binding.
|
||||
- Restricted integer formula language with typed AST, exact diagnostics, bounds
|
||||
and deterministic Lean goal generation.
|
||||
- Finite exact-integer program model bridge (`+ - *`, local rebinding, final
|
||||
return) mapped to `@[expose]` Lean definitions; mutation refutation.
|
||||
- Fixed Lean 4.36 + Mathlib backend pinned by `lean/lean-toolchain` and
|
||||
`lean/lake-manifest.json`; bounded fixed search template.
|
||||
- Independent verification: stock `lean4export` proof closure, official
|
||||
`con-leche --verified` kernel replay, freshly regenerated expected
|
||||
proposition, type alpha-equivalence, metavariable rejection, axiom allowlist.
|
||||
- Content-addressed `marqdo.proof` revision 1 bundles (`manifest.json` +
|
||||
`proof.ndjson`), atomic publication, replay without search, stale and tamper
|
||||
rejection.
|
||||
- `tool.json` bundle for `marqdo tool install` and `scripts/package-tool.sh`.
|
||||
- Woodpecker CI lanes: Rust gates + tool packaging; manual real-CLI contract lane.
|
||||
- 95 automated tests locally (69 unit + 3 analysis + 12 formula + 11 document)
|
||||
and 11 ignored Lean-backed acceptance tests; all executed and green on the
|
||||
recorded environment.
|
||||
|
||||
### Changed
|
||||
|
||||
- `docs/DEVELOPMENT.md` is the single maintained specification (moved from the
|
||||
repository root).
|
||||
- Exit codes: 0 all requested targets verified or no target; 1 any unverified
|
||||
outcome (including refuted/unknown/unsupported/invalid/blocked/stale);
|
||||
2 engineering/contract/backend failure.
|
||||
|
||||
### Known limitations (beta, by design)
|
||||
|
||||
- No network/OS sandbox or cgroup memory cap for the Lean backend; wall-clock
|
||||
and CPU limits only. Address-space rlimits are unusable on the pinned Mathlib
|
||||
(measured: 6/9 GiB fail).
|
||||
- Search is a fixed template, not a general prover; goals outside it return
|
||||
`unknown`.
|
||||
- No real/complex/matrix/sum/existence/free-variable math; no loops, branches,
|
||||
calls, floats or `/` in program models.
|
||||
- Premise non-emptiness is not proven; conditional propositions keep their full
|
||||
antecedent and can be vacuously true.
|
||||
- No cross-Lean-version replay; a bundle requires the same pinned environment.
|
||||
- No clean-machine release artifacts beyond the tool bundle; CI does not run the
|
||||
Lean acceptance suite on the shared runner.
|
||||
Generated
+1
-1
@@ -76,7 +76,7 @@ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
|
||||
|
||||
[[package]]
|
||||
name = "marqdo-prove"
|
||||
version = "0.1.0"
|
||||
version = "0.1.0-beta.1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"num-bigint",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "marqdo-prove"
|
||||
version = "0.1.0"
|
||||
version = "0.1.0-beta.1"
|
||||
edition = "2021"
|
||||
rust-version = "1.85"
|
||||
license = "Apache-2.0"
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# marqdo-prove
|
||||
|
||||
> **Status: `v0.1.0-beta.1` (beta).** The proof pipeline is real and
|
||||
> independently verified on the recorded environment, but the full stable
|
||||
> release gates are not all met. See [`docs/RELEASE.md`](docs/RELEASE.md) for the
|
||||
> beta scope, CI lanes and the explicit remaining work, and [`docs/STATUS.md`](docs/STATUS.md)
|
||||
> for executed evidence.
|
||||
|
||||
Static, link-driven mathematical proof checking for Marqdo knowledge documents.
|
||||
|
||||
A `.mq.md` document stays ordinary, readable Markdown. A Knowledge H2 that also
|
||||
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
# Release notes and procedure (beta)
|
||||
|
||||
Current release: **`v0.1.0-beta.1`** (beta, not a stable release).
|
||||
Normative design: [`DEVELOPMENT.md`](DEVELOPMENT.md). Executed evidence:
|
||||
[`STATUS.md`](STATUS.md). This file records the release identity, how the beta
|
||||
was produced, what CI covers, and what remains before a stable release.
|
||||
|
||||
## 1. What this beta is
|
||||
|
||||
The first real proof pipeline for Marqdo knowledge documents:
|
||||
|
||||
- `check`: select proof units from real `marqdo.analysis` revision 3, resolve
|
||||
declared local theorem/program-model links exactly, prove the bounded integer
|
||||
propositions on the pinned Lean 4.36 + Mathlib backend, verify through an
|
||||
independent kernel replay path, and publish content-addressed proof bundles.
|
||||
- `replay`: re-verify a saved bundle against the current sources and the fixed
|
||||
environment without proof search.
|
||||
- `marqdo tool install` compatible bundle (`tool.json`, `api_revision: 1`,
|
||||
`analysis: 3`).
|
||||
|
||||
It is a beta because the full release gates in `DEVELOPMENT.md` §13–§14 are
|
||||
**not** all met. Missing or partial items are listed in §6 below; the honest
|
||||
evidence, including failed environment experiments, is in [`STATUS.md`](STATUS.md).
|
||||
|
||||
## 2. Release identity
|
||||
|
||||
| Item | Value |
|
||||
| --- | --- |
|
||||
| Version | `0.1.0-beta.1` |
|
||||
| Git tag | `v0.1.0-beta.1` |
|
||||
| Artifact | tool bundle directory `marqdo-prove-tool/` (`bin/marqdo-prove`, `tool.json`, pinned `lean/` project) |
|
||||
| Archive | `marqdo-prove-v0.1.0-beta.1-x86_64-unknown-linux-gnu-tool.tar.gz` + `SHA256SUMS` |
|
||||
| Fixed backend | Lean `leanprover/lean4:v4.36.0` + Mathlib `fc4f59e577feb1a4956671bc04ac18aaaf8cd842` (pinned in `lean/`) |
|
||||
| Upstream CLI | Marqdo `3.0.0-rc.4`, Analysis revision 3 |
|
||||
| Platform | Linux x86_64 |
|
||||
|
||||
The bundle intentionally does **not** embed the Lean toolchain or Mathlib olean
|
||||
cache (several GiB): the installed tool discovers the pinned backend through
|
||||
`MARQDO_PROVE_LEAN_ROOT` / `MARQDO_PROVE_LEAN_BIN_DIR` and fails closed with
|
||||
`backend.unavailable` when it is absent. See `README.md` for one-time setup.
|
||||
|
||||
## 3. Local-only credentials
|
||||
|
||||
Release/CI credentials live **only** in `.secrets/release.env` in the local
|
||||
worktree. That directory is ignored by `.gitignore` (`/.secrets/`) and must never
|
||||
be committed or pushed. The variables are consumed by
|
||||
`scripts/release-beta.sh` and by the Woodpecker API calls:
|
||||
|
||||
| Variable | Purpose |
|
||||
| --- | --- |
|
||||
| `MARQDO_GIT_USERNAME`, `MARQDO_GIT_TOKEN` | Gitea push/release API authentication |
|
||||
| `MARQDO_WOODPECKER_URL`, `MARQDO_WOODPECKER_TOKEN` | Woodpecker repo activation and release pipeline control |
|
||||
| `MARQDO_CI_SECRET` | reserved CI-side release secret, stored as a Woodpecker repository secret (never in git) |
|
||||
|
||||
The Gitea token is passed to `git` through a transient credential helper that
|
||||
reads the environment; it never appears in `git remote` URLs, argv, logs or
|
||||
committed files. `scripts/release-beta.sh` never echoes secret values.
|
||||
|
||||
## 4. How the beta is produced
|
||||
|
||||
```sh
|
||||
# 1. local gates (same commands as CI)
|
||||
cargo fmt --all -- --check
|
||||
cargo clippy --all-targets -- -D warnings
|
||||
cargo test --locked
|
||||
|
||||
# 2. pin and record the real-CLI + Lean evidence (dedicated environment)
|
||||
MARQDO_BIN=/path/to/marqdo cargo test --test e2e -- --ignored --test-threads=1
|
||||
|
||||
# 3. build the tool bundle and archive
|
||||
./scripts/package-tool.sh dist/marqdo-prove-tool
|
||||
cargo build --release --locked
|
||||
tar -czf marqdo-prove-$(git describe --tags --always)-x86_64-unknown-linux-gnu-tool.tar.gz \
|
||||
-C dist marqdo-prove-tool
|
||||
sha256sum ... > SHA256SUMS
|
||||
|
||||
# 4. tag + push + activate CI (uses .secrets/release.env, never printed)
|
||||
./scripts/release-beta.sh
|
||||
|
||||
# 5. record CI evidence in this file and STATUS.md, commit and push again
|
||||
```
|
||||
|
||||
`scripts/release-beta.sh` performs the remote half of step 4: it verifies the
|
||||
local gates, tags `v<version>`, pushes `master` and the tag with the
|
||||
environment-based credential helper, idempotently activates the repository in
|
||||
Woodpecker (`POST /api/repos?forge_remote_id=<gitea id>`), and creates the Gitea
|
||||
prerelease for the tag. Build/packaging steps stay explicit so the artifact
|
||||
digest is reviewable.
|
||||
|
||||
## 5. CI/CD coverage
|
||||
|
||||
Two Woodpecker lanes are committed (`.woodpecker/`):
|
||||
|
||||
| Lane | Trigger | What it runs |
|
||||
| --- | --- | --- |
|
||||
| `main.yml` → `test` | push, PR, tag | `cargo fmt --check`, `cargo clippy --all-targets -- -D warnings`, `cargo test --locked`, release build, `--version` smoke check |
|
||||
| `main.yml` → `package` | tag, push, PR | release build, `scripts/package-tool.sh`, tool-bundle archive + `SHA256SUMS` |
|
||||
| `contract.yml` → `contract` | manual | clones `marqdo-cli`, builds the real CLI, runs `tests/analysis_document` and `tests/document_contract` against it (`MARQDO_BIN`) |
|
||||
|
||||
Why the Lean acceptance suite is not on the shared docker runner: the pinned
|
||||
backend needs the 7.5 GiB Mathlib olean closure and minutes per target; the
|
||||
shared runner is not provisioned for it. The suite is committed, green on the
|
||||
recorded environment (see `STATUS.md`) and is the first item on the
|
||||
dedicated-runner backlog. CI is used to close the gaps it *can* close (Rust
|
||||
gates, packaging, clean-container real-CLI contract) instead of pretending the
|
||||
rest is covered.
|
||||
|
||||
**Recorded pipeline results for this beta are appended in §8.**
|
||||
|
||||
## 6. Remaining work before a stable release
|
||||
|
||||
Ordered by release risk; this is the honest gap list, not a roadmap promise.
|
||||
|
||||
1. **Dedicated CI runner for the Lean acceptance suite** (`tests/e2e.rs`, 11
|
||||
tests) and the pinned Mathlib cache artifact; include the `contract` lane as
|
||||
a required gate.
|
||||
2. **Resource isolation**: OS-level sandbox/cgroup for search and replay
|
||||
(network off, memory cap, process-group cleanup). Today the limits are
|
||||
wall-clock + CPU rlimit; the address-space cap was measured unusable with
|
||||
this Mathlib closure.
|
||||
3. **Evaluation corpus** from `DEVELOPMENT.md` §13.1: 40 reviewable positive
|
||||
propositions (≥10 linked, ≥5 cross-file, ≥8 program models), 20 false, 20
|
||||
unsupported/invalid, differential program-model fixtures against the real
|
||||
CLI runtime.
|
||||
4. **Performance evidence** P50/P95 for cold backend, first proof, linked reuse
|
||||
and replay, with cached Mathlib on a dedicated runner.
|
||||
5. **Stable packaging**: clean-machine install transcript, archive signatures,
|
||||
source-SHA file, reproducible artifact digest, and a documented
|
||||
upgrade/cache-invalidation policy.
|
||||
6. **Known semantic boundaries stay explicit**: no real/rational/matrix math, no
|
||||
general prover, no runtime refinement, no premise non-emptiness proof. These
|
||||
are scope decisions of the first release, not beta regressions.
|
||||
|
||||
## 7. Rollback and cache policy
|
||||
|
||||
`v0.1.0-beta.1` changes the tool version, which is part of the proof-bundle
|
||||
content identity. Existing local caches from `0.1.0` builds are not migrated:
|
||||
delete `<project>/.marqdo/prove/` and re-run `check`. Bundles are never mutated
|
||||
in place; a failed export leaves no bundle-looking partial directory.
|
||||
|
||||
## 8. Recorded evidence for this beta
|
||||
|
||||
Filled in after the release push and CI run; see also
|
||||
[`STATUS.md`](STATUS.md) for the full executed-evidence table.
|
||||
|
||||
| Check | Result |
|
||||
| --- | --- |
|
||||
| Local Rust gates (`fmt` / `clippy -D warnings` / `cargo test`) | passed before tag (`cargo test`: 69 unit + 3 + 11 + 12 tests, release build `marqdo-prove 0.1.0-beta.1`) |
|
||||
| Local Lean acceptance suite (`e2e --ignored`) after version bump | **11 passed, 0 failed, 298.70 s** (real CLI revision 3 + pinned Lean/Mathlib + con-leche replay) |
|
||||
| Tool bundle | `marqdo-prove-tool/` (2.7 MiB uncompressed: binary, manifest, pinned `lean/` sources; toolchain/Mathlib installed separately) |
|
||||
| Tool bundle archive | `marqdo-prove-v0.1.0-beta.1-x86_64-unknown-linux-gnu-tool.tar.gz` (929,877 bytes) |
|
||||
| Artifact archive SHA-256 | `faa46e93a26538608eb80e9157ee19b4610b456ba5d784eab43070352f88ea40` |
|
||||
| Woodpecker pipeline (push/tag, SHA) | *pending* |
|
||||
| Gitea prerelease | *pending* |
|
||||
|
||||
The same archive and `SHA256SUMS` are rebuilt and printed by the CI `package`
|
||||
lane, so the committed digest can be compared with the CI log.
|
||||
|
||||
## 9. Security notes
|
||||
|
||||
- Prove never executes `.mq.md` code, never fetches network knowledge, and only
|
||||
invokes the fixed Lean toolchain and the fixed verifier executables.
|
||||
- Proof payloads and analysed source documents are untrusted data: replay
|
||||
kernel-checks the closure, regenerates the expected proposition from the
|
||||
current sources, rejects metavariables and untrusted axioms.
|
||||
- Credentials for release live outside git and outside the tool bundle. The
|
||||
committed Woodpecker configuration contains no secrets; values are injected
|
||||
as repository secrets by the maintainer.
|
||||
+3
-3
@@ -11,7 +11,7 @@ the target design.
|
||||
| --- | --- |
|
||||
| Repository | `marqdo-prove` (this tree) |
|
||||
| Commit at evidence time | see `git log` on this tree (the status file is updated in the same commit as the evidence) |
|
||||
| Prove version | `0.1.0` |
|
||||
| Prove version | `0.1.0-beta.1` (beta release; see `docs/RELEASE.md`) |
|
||||
| Tool manifest | `tool.json`: `requires.api_revision: 1`, `requires.analysis: 3` |
|
||||
| Platform | Linux x86_64, 8 vCPU, 14 GiB RAM, no network during checks |
|
||||
| Rust | `rustc 1.100.0` / `cargo 1.100.0` (local toolchain) |
|
||||
@@ -92,7 +92,7 @@ Observed results (wall clock, warm filesystem, debug build of Prove):
|
||||
| `marqdo tool install tool-bundle/tool.json` then `marqdo prove --version` and `marqdo prove check examples/algebra.mq.md --json` | installed tool dispatches through the real CLI Tool Protocol (`api_revision 1`), version `marqdo-prove 0.1.0`, target `verified` (cache hit, ~10 s) |
|
||||
|
||||
Run as `cargo test --test e2e -- --ignored --test-threads=1` (requires
|
||||
`MARQDO_BIN` and the fixed backend): **11 passed, 0 failed, 271.39 s**.
|
||||
`MARQDO_BIN` and the fixed backend): **11 passed, 0 failed; 271.39 s before the beta version bump and 298.70 s after it (cache identity includes the tool version, so the beta run re-proved everything).**
|
||||
|
||||
## Executed test suite
|
||||
|
||||
@@ -108,7 +108,7 @@ cargo test # see counts below
|
||||
| `tests/analysis_document.rs` (real CLI, entry extraction) | 3 passed |
|
||||
| `tests/formula_contract.rs` (grammar, precedence, bounds, diagnostics, rendering, evaluation) | 12 passed |
|
||||
| `tests/document_contract.rs` (no-target, shape errors, unsupported/invalid formulas, missing/external links, cycles, `--unit`, upstream static failure, root escape) | 11 passed |
|
||||
| `tests/e2e.rs` (Lean-backed, `#[ignore]`) | 11 passed, 271.39 s |
|
||||
| `tests/e2e.rs` (Lean-backed, `#[ignore]`) | 11 passed: 271.39 s, and 298.70 s re-run after the beta version bump |
|
||||
|
||||
## Tool installation evidence
|
||||
|
||||
|
||||
Executable
+155
@@ -0,0 +1,155 @@
|
||||
#!/usr/bin/env bash
|
||||
# Beta release driver for marqdo-prove.
|
||||
#
|
||||
# Preconditions:
|
||||
# * local gates already passed (fmt, clippy -D warnings, cargo test, and the
|
||||
# dedicated Lean acceptance suite where applicable);
|
||||
# * `.secrets/release.env` exists locally with the release/CI credentials
|
||||
# (ignored by git; never commit or echo it).
|
||||
#
|
||||
# What it does:
|
||||
# * verifies the version in Cargo.toml is a pre-release (<x.y.z>-beta.<n>);
|
||||
# * runs the local Rust gates;
|
||||
# * tags `v<version>` if missing;
|
||||
# * pushes master and the tag with a transient environment credential helper;
|
||||
# * idempotently activates the repository in Woodpecker;
|
||||
# * creates or updates the Gitea prerelease for the tag from CHANGELOG.md.
|
||||
#
|
||||
# It never prints tokens, never writes credentials to disk, and never commits.
|
||||
set -euo pipefail
|
||||
|
||||
repo_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
cd "$repo_root"
|
||||
|
||||
secrets_file=${MARQDO_RELEASE_ENV:-"$repo_root/.secrets/release.env"}
|
||||
if [ ! -f "$secrets_file" ]; then
|
||||
echo "error: $secrets_file is missing (local-only credentials; see docs/RELEASE.md)" >&2
|
||||
exit 2
|
||||
fi
|
||||
# shellcheck disable=SC1090
|
||||
set -a
|
||||
. "$secrets_file"
|
||||
set +a
|
||||
|
||||
: "${MARQDO_GIT_USERNAME:?missing MARQDO_GIT_USERNAME}"
|
||||
: "${MARQDO_GIT_TOKEN:?missing MARQDO_GIT_TOKEN}"
|
||||
: "${MARQDO_WOODPECKER_URL:?missing MARQDO_WOODPECKER_URL}"
|
||||
: "${MARQDO_WOODPECKER_TOKEN:?missing MARQDO_WOODPECKER_TOKEN}"
|
||||
|
||||
version=$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -1)
|
||||
case "$version" in
|
||||
*-beta.*) ;;
|
||||
*)
|
||||
echo "error: version '$version' is not a beta pre-release; refusing to tag" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
tag="v$version"
|
||||
|
||||
git_repo="https://git.cflmy.cn/cflmy/marqdo-prove.git"
|
||||
gitea_api="https://git.cflmy.cn/api/v1/repos/cflmy/marqdo-prove"
|
||||
|
||||
# Transient credential helper: the token stays in the environment and is not
|
||||
# part of the invocation argv or any stored remote URL.
|
||||
helper='!f() { test "$1" = get || exit 1; echo "username=${MARQDO_GIT_USERNAME}"; echo "password=${MARQDO_GIT_TOKEN}"; }; f'
|
||||
git_push() {
|
||||
git -c credential.helper="$helper" push "$git_repo" "$@"
|
||||
}
|
||||
|
||||
echo "== local gates"
|
||||
cargo fmt --all -- --check
|
||||
cargo clippy --all-targets -- -D warnings
|
||||
cargo test --locked
|
||||
|
||||
echo "== git tree must be clean"
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "error: working tree is dirty; commit first" >&2
|
||||
git status --short >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "== tag $tag"
|
||||
if git rev-parse -q --verify "refs/tags/$tag" >/dev/null; then
|
||||
echo "tag $tag already exists locally"
|
||||
else
|
||||
git tag -a "$tag" -m "marqdo-prove $version (beta)"
|
||||
fi
|
||||
|
||||
echo "== push master and $tag"
|
||||
git_push HEAD:refs/heads/master
|
||||
git_push "refs/tags/$tag:refs/tags/$tag"
|
||||
|
||||
gitea_id=$(timeout 30 curl -sS -H "Authorization: token $MARQDO_GIT_TOKEN" "$gitea_api" |
|
||||
sed -n 's/.*"id":\([0-9]\+\).*/\1/p' | head -1)
|
||||
if [ -z "$gitea_id" ]; then
|
||||
echo "warning: could not read the Gitea repository id; skipping Woodpecker activation" >&2
|
||||
else
|
||||
echo "== activate Woodpecker repository (forge_remote_id=$gitea_id, idempotent)"
|
||||
timeout 60 curl -sS -o /dev/null -w "activate: HTTP %{http_code}\n" \
|
||||
-X POST -H "Authorization: Bearer $MARQDO_WOODPECKER_TOKEN" \
|
||||
"$MARQDO_WOODPECKER_URL/api/repos?forge_remote_id=$gitea_id" || true
|
||||
fi
|
||||
|
||||
echo "== Gitea prerelease"
|
||||
notes_file=$(mktemp)
|
||||
trap 'rm -f "$notes_file"' EXIT
|
||||
{
|
||||
echo "Beta release of marqdo-prove \`$version\`."
|
||||
echo
|
||||
echo "The first real, link-driven proof pipeline is usable and independently"
|
||||
echo "verified on the recorded environment, but the full stable-release gates"
|
||||
echo "are not all met. See \`docs/RELEASE.md\` and \`docs/STATUS.md\` in the tag."
|
||||
echo
|
||||
sed -n '/^## v/,$p' CHANGELOG.md | head -90
|
||||
} > "$notes_file"
|
||||
python3 - "$notes_file" "$tag" "$version" "$gitea_api" <<'PY'
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
notes_path, tag, version, api = sys.argv[1:]
|
||||
with open(notes_path, encoding="utf-8") as handle:
|
||||
body = handle.read()
|
||||
payload = {
|
||||
"tag_name": tag,
|
||||
"target_commitish": "master",
|
||||
"name": f"marqdo-prove {version} (beta)",
|
||||
"body": body,
|
||||
"draft": False,
|
||||
"prerelease": True,
|
||||
}
|
||||
token = os.environ["MARQDO_GIT_TOKEN"]
|
||||
headers = {
|
||||
"Authorization": f"token {token}",
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json",
|
||||
}
|
||||
created = False
|
||||
request = urllib.request.Request(
|
||||
f"{api}/releases",
|
||||
data=json.dumps(payload).encode(),
|
||||
method="POST",
|
||||
headers=headers,
|
||||
)
|
||||
try:
|
||||
with urllib.request.urlopen(request, timeout=30) as response:
|
||||
data = json.load(response)
|
||||
print(f"create release: HTTP {response.status} {data.get('html_url')}")
|
||||
created = True
|
||||
except urllib.error.HTTPError as error:
|
||||
print(f"create release failed: HTTP {error.code}", file=sys.stderr)
|
||||
if not created:
|
||||
request = urllib.request.Request(
|
||||
f"{api}/releases/tags/{tag}",
|
||||
data=json.dumps(payload).encode(),
|
||||
method="PATCH",
|
||||
headers=headers,
|
||||
)
|
||||
with urllib.request.urlopen(request, timeout=30) as response:
|
||||
data = json.load(response)
|
||||
print(f"update release: HTTP {response.status} {data.get('html_url')}")
|
||||
PY
|
||||
|
||||
echo "== done: $tag pushed; see docs/RELEASE.md §5 for CI details"
|
||||
Reference in new issue
Block a user