ci: add gitea workflows and signed release pipeline
CI runs fmt, clippy and tests. Tag releases build Linux and Windows (mingw cross) artifacts, SHA256SUMS and an Ed25519 signed manifest, then publish via the Gitea API. Helper scripts live in scripts/release, docs in docs/release.md.
This commit is contained in:
parent
ebea98e9a4
commit
948d10bd37
6 changed files with 649 additions and 0 deletions
49
scripts/release/keygen.py
Executable file
49
scripts/release/keygen.py
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Generate an Ed25519 release signing key pair for VNOX.
|
||||
|
||||
The private key is a base64 encoded raw 32 byte seed. Store it ONLY in the
|
||||
Gitea secret VNOX_RELEASE_SIGNING_KEY. The public key is printed as base64 (raw
|
||||
32 bytes) and as a Rust byte array, to be embedded in the client updater.
|
||||
|
||||
Usage:
|
||||
scripts/release/keygen.py # print both keys to stdout
|
||||
scripts/release/keygen.py --private-out key.b64 # write the seed to a 0600 file
|
||||
"""
|
||||
import argparse
|
||||
import base64
|
||||
import os
|
||||
import sys
|
||||
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
|
||||
|
||||
|
||||
def main() -> int:
|
||||
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
ap.add_argument("--private-out", help="write the private seed to this file (mode 0600) instead of stdout")
|
||||
args = ap.parse_args()
|
||||
|
||||
key = Ed25519PrivateKey.generate()
|
||||
seed = key.private_bytes(
|
||||
serialization.Encoding.Raw, serialization.PrivateFormat.Raw, serialization.NoEncryption()
|
||||
)
|
||||
pub = key.public_key().public_bytes(serialization.Encoding.Raw, serialization.PublicFormat.Raw)
|
||||
seed_b64 = base64.b64encode(seed).decode()
|
||||
pub_b64 = base64.b64encode(pub).decode()
|
||||
|
||||
if args.private_out:
|
||||
fd = os.open(args.private_out, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
|
||||
with os.fdopen(fd, "w") as f:
|
||||
f.write(seed_b64 + "\n")
|
||||
print(f"private seed written to {args.private_out} (mode 0600)")
|
||||
else:
|
||||
print(f"VNOX_RELEASE_SIGNING_KEY (private, secret, base64 seed):\n{seed_b64}\n")
|
||||
print(f"public key (base64, raw 32 bytes):\n{pub_b64}\n")
|
||||
rust = ", ".join(f"0x{b:02x}" for b in pub)
|
||||
print("Rust constant for the updater:")
|
||||
print(f"pub const RELEASE_PUBLIC_KEY: [u8; 32] = [{rust}];")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Loading…
Add table
Add a link
Reference in a new issue