[WIP] User Invites

This commit is contained in:
Alex Emmet 2026-09-10 23:14:25 +02:00
commit 7164f4671d
No known key found for this signature in database
24 changed files with 2829 additions and 170 deletions

View file

@ -1,25 +1,38 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ "$#" -ne 8 ]]; then
echo "usage: $0 BINARY_DIRECTORY PRODUCT_VERSION CHANNEL PUBLISHED_AT OS ARCHITECTURE BASE_URL OUTPUT.json" >&2
if [[ "$#" -ne 10 ]]; then
echo "usage: $0 BINARY_DIRECTORY PRODUCT_VERSION CHANNEL RELEASE_SEQUENCE PUBLISHED_AT EXPIRES_AT OS ARCHITECTURE BASE_URL OUTPUT.json" >&2
exit 2
fi
binary_directory="$1"
product_version="$2"
channel="$3"
published_at="$4"
operating_system="$5"
architecture="$6"
base_url="$(printf '%s' "$7" | sed 's#/$##')"
output="$8"
release_sequence="$4"
published_at="$5"
expires_at="$6"
operating_system="$7"
architecture="$8"
base_url="$(printf '%s' "$9" | sed 's#/$##')"
output="${10}"
repository_directory="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
contract="$repository_directory/iota-updater/artifacts.tsv"
staging_directory="$(mktemp -d)"
artifacts="$staging_directory/artifacts.jsonl"
trap 'rm -rf "$staging_directory"' EXIT
if [[ ! "$release_sequence" =~ ^[1-9][0-9]*$ ]]; then
echo "release sequence must be a positive integer" >&2
exit 2
fi
published_epoch="$(date -d "$published_at" +%s)"
expires_epoch="$(date -d "$expires_at" +%s)"
if (( expires_epoch <= published_epoch )); then
echo "expires_at must be after published_at" >&2
exit 2
fi
while IFS=$'\t' read -r role artifact_path; do
[[ -n "$role" && -n "$artifact_path" ]] || continue
asset_name="$(basename "$artifact_path")"
@ -40,12 +53,16 @@ mkdir -p "$(dirname "$output")"
jq -s \
--arg product_version "$product_version" \
--arg channel "$channel" \
--argjson release_sequence "$release_sequence" \
--arg published_at "$published_at" \
--arg expires_at "$expires_at" \
--arg release_signing_key_id "primary" \
'{
product_version: $product_version,
channel: $channel,
release_sequence: $release_sequence,
published_at: $published_at,
expires_at: $expires_at,
minimum_data_schema: 1,
supported_ipc_min: 2,
supported_ipc_max: 4,