Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 9 additions & 39 deletions .github/scripts/release/r2/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public_url="${FLAVOR_RELEASES_PUBLIC_URL%/}"
version_prefix="$RELEASE_CHANNEL/versions/$RELEASE_VERSION"
latest_prefix="$RELEASE_CHANNEL/latest"
metadata_path="$release_root/metadata.json"
publish_root_installers=0
publish_root_manage=0

if [ "$RELEASE_CHANNEL" = "stable" ]; then
publish_root_installers=1
publish_root_manage=1
fi

upload() {
Expand Down Expand Up @@ -59,27 +59,17 @@ for file_path in "$release_root"/flavor-*.tar.gz "$release_root"/flavor-*.zip "$
upload "$file_path" "$version_prefix/$name" "$(artifact_content_type "$name")" "public, max-age=31536000, immutable"
done

upload "$GITHUB_WORKSPACE/install.sh" "$version_prefix/install.sh" "text/x-shellscript; charset=utf-8" "public, max-age=31536000, immutable"
upload "$GITHUB_WORKSPACE/install.ps1" "$version_prefix/install.ps1" "text/plain; charset=utf-8" "public, max-age=31536000, immutable"
upload "$GITHUB_WORKSPACE/uninstall.sh" "$version_prefix/uninstall.sh" "text/x-shellscript; charset=utf-8" "public, max-age=31536000, immutable"
upload "$GITHUB_WORKSPACE/uninstall.ps1" "$version_prefix/uninstall.ps1" "text/plain; charset=utf-8" "public, max-age=31536000, immutable"
upload "$GITHUB_WORKSPACE/install.sh" "$latest_prefix/install.sh" "text/x-shellscript; charset=utf-8" "public, max-age=60, must-revalidate"
upload "$GITHUB_WORKSPACE/install.ps1" "$latest_prefix/install.ps1" "text/plain; charset=utf-8" "public, max-age=60, must-revalidate"
upload "$GITHUB_WORKSPACE/uninstall.sh" "$latest_prefix/uninstall.sh" "text/x-shellscript; charset=utf-8" "public, max-age=60, must-revalidate"
upload "$GITHUB_WORKSPACE/uninstall.ps1" "$latest_prefix/uninstall.ps1" "text/plain; charset=utf-8" "public, max-age=60, must-revalidate"
if [ "$publish_root_installers" -eq 1 ]; then
upload "$GITHUB_WORKSPACE/install.sh" "install.sh" "text/x-shellscript; charset=utf-8" "public, max-age=60, must-revalidate"
upload "$GITHUB_WORKSPACE/install.ps1" "install.ps1" "text/plain; charset=utf-8" "public, max-age=60, must-revalidate"
upload "$GITHUB_WORKSPACE/uninstall.sh" "uninstall.sh" "text/x-shellscript; charset=utf-8" "public, max-age=60, must-revalidate"
upload "$GITHUB_WORKSPACE/uninstall.ps1" "uninstall.ps1" "text/plain; charset=utf-8" "public, max-age=60, must-revalidate"
if [ "$publish_root_manage" -eq 1 ]; then
upload "$GITHUB_WORKSPACE/manage.sh" "manage.sh" "text/x-shellscript; charset=utf-8" "public, max-age=60, must-revalidate"
upload "$GITHUB_WORKSPACE/manage.ps1" "manage.ps1" "text/plain; charset=utf-8" "public, max-age=60, must-revalidate"
fi

PUBLIC_URL="$public_url" \
VERSION_PREFIX="$version_prefix" \
LATEST_PREFIX="$latest_prefix" \
RELEASE_ROOT="$release_root" \
METADATA_PATH="$metadata_path" \
PUBLISH_ROOT_INSTALLERS="$publish_root_installers" \
PUBLISH_ROOT_MANAGE="$publish_root_manage" \
python3 <<'PY'
import json
import os
Expand Down Expand Up @@ -122,29 +112,9 @@ metadata = {
"versionPrefix": version_prefix,
"latestPrefix": latest_prefix,
},
"install": {
"unix": (
f"{public_url}/install.sh"
if env["PUBLISH_ROOT_INSTALLERS"] == "1"
else f"{public_url}/{latest_prefix}/install.sh"
),
"windows": (
f"{public_url}/install.ps1"
if env["PUBLISH_ROOT_INSTALLERS"] == "1"
else f"{public_url}/{latest_prefix}/install.ps1"
),
},
"uninstall": {
"unix": (
f"{public_url}/uninstall.sh"
if env["PUBLISH_ROOT_INSTALLERS"] == "1"
else f"{public_url}/{latest_prefix}/uninstall.sh"
),
"windows": (
f"{public_url}/uninstall.ps1"
if env["PUBLISH_ROOT_INSTALLERS"] == "1"
else f"{public_url}/{latest_prefix}/uninstall.ps1"
),
"manage": {
"unix": f"{public_url}/manage.sh",
"windows": f"{public_url}/manage.ps1",
},
"artifacts": {
"linuxX64": artifact("flavor-x86_64-unknown-linux-gnu.tar.gz", "application/gzip"),
Expand Down
8 changes: 2 additions & 6 deletions .github/scripts/release/r2/summary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ done
echo ""
echo "### Links"
echo ""
if [ "$RELEASE_CHANNEL" = "stable" ]; then
echo "- Stable unix installer: ${FLAVOR_RELEASES_PUBLIC_URL%/}/install.sh"
echo "- Stable windows installer: ${FLAVOR_RELEASES_PUBLIC_URL%/}/install.ps1"
echo "- Stable unix uninstaller: ${FLAVOR_RELEASES_PUBLIC_URL%/}/uninstall.sh"
echo "- Stable windows uninstaller: ${FLAVOR_RELEASES_PUBLIC_URL%/}/uninstall.ps1"
fi
echo "- Unix manager: ${FLAVOR_RELEASES_PUBLIC_URL%/}/manage.sh"
echo "- Windows manager: ${FLAVOR_RELEASES_PUBLIC_URL%/}/manage.ps1"
echo "- Latest metadata: ${R2_METADATA_URL}"
echo "- Version metadata: ${R2_VERSION_METADATA_URL}"
} >> "$GITHUB_STEP_SUMMARY"
40 changes: 8 additions & 32 deletions .github/scripts/release/r2/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,12 @@ if metadata["channel"] != os.environ["EXPECTED_CHANNEL"]:
if metadata["releaseVersion"] != os.environ["EXPECTED_RELEASE_VERSION"]:
raise SystemExit(f"unexpected releaseVersion: {metadata['releaseVersion']}")
expected_public_url = os.environ["EXPECTED_PUBLIC_URL"]
expected_unix = (
f"{expected_public_url}/install.sh"
if metadata["channel"] == "stable"
else f"{expected_public_url}/{metadata['channel']}/latest/install.sh"
)
expected_windows = (
f"{expected_public_url}/install.ps1"
if metadata["channel"] == "stable"
else f"{expected_public_url}/{metadata['channel']}/latest/install.ps1"
)
expected_uninstall_unix = (
f"{expected_public_url}/uninstall.sh"
if metadata["channel"] == "stable"
else f"{expected_public_url}/{metadata['channel']}/latest/uninstall.sh"
)
expected_uninstall_windows = (
f"{expected_public_url}/uninstall.ps1"
if metadata["channel"] == "stable"
else f"{expected_public_url}/{metadata['channel']}/latest/uninstall.ps1"
)
if metadata["install"]["unix"] != expected_unix:
raise SystemExit(f"unexpected unix installer url: {metadata['install']['unix']}")
if metadata["install"]["windows"] != expected_windows:
raise SystemExit(f"unexpected windows installer url: {metadata['install']['windows']}")
if metadata["uninstall"]["unix"] != expected_uninstall_unix:
raise SystemExit(f"unexpected unix uninstaller url: {metadata['uninstall']['unix']}")
if metadata["uninstall"]["windows"] != expected_uninstall_windows:
raise SystemExit(f"unexpected windows uninstaller url: {metadata['uninstall']['windows']}")
expected_manage_unix = f"{expected_public_url}/manage.sh"
expected_manage_windows = f"{expected_public_url}/manage.ps1"
if metadata["manage"]["unix"] != expected_manage_unix:
raise SystemExit(f"unexpected unix manager url: {metadata['manage']['unix']}")
if metadata["manage"]["windows"] != expected_manage_windows:
raise SystemExit(f"unexpected windows manager url: {metadata['manage']['windows']}")
if metadata["channel"] == "beta":
if metadata.get("betaVersion") != os.environ["EXPECTED_RELEASE_VERSION"]:
raise SystemExit(f"unexpected betaVersion: {metadata.get('betaVersion')}")
Expand All @@ -77,10 +55,8 @@ from pathlib import Path
metadata = json.loads(Path(sys.argv[1]).read_text(encoding="utf-8"))
for item in metadata["artifacts"].values():
print(item["url"])
print(metadata["install"]["unix"])
print(metadata["install"]["windows"])
print(metadata["uninstall"]["unix"])
print(metadata["uninstall"]["windows"])
print(metadata["manage"]["unix"])
print(metadata["manage"]["windows"])
PY
); do
curl -fsSI "$url" >/dev/null
Expand Down
8 changes: 4 additions & 4 deletions .github/scripts/release/smoke/smoke.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ try {
$env:FLAVOR_INSTALL_ROOT = Join-Path $tmpdir 'install'
$env:FLAVOR_LOCAL_BIN_DIR = Join-Path $tmpdir 'bin'
New-Item -ItemType Directory -Force -Path $env:FLAVOR_INSTALL_ROOT, $env:FLAVOR_LOCAL_BIN_DIR | Out-Null
& (Join-Path $root 'install.ps1') install --channel $channel --version $version
& (Join-Path $root 'manage.ps1') install --channel $channel --version $version --retain=false
& (Join-Path $env:FLAVOR_LOCAL_BIN_DIR 'flavor.exe') --version
& (Join-Path $env:FLAVOR_LOCAL_BIN_DIR 'flavor.exe') check --root $root --config (Join-Path $root 'flavor.json')
& (Join-Path $root 'uninstall.ps1') --version $version
& (Join-Path $root 'manage.ps1') uninstall --version $version
if (Test-Path (Join-Path $env:FLAVOR_INSTALL_ROOT $version)) {
throw "version uninstall left $(Join-Path $env:FLAVOR_INSTALL_ROOT $version)"
}

if ($env:SMOKE_LATEST -eq '1') {
Remove-Item -Force -ErrorAction SilentlyContinue (Join-Path $env:FLAVOR_LOCAL_BIN_DIR 'flavor.exe')
$env:FLAVOR_INSTALL_ROOT = Join-Path $tmpdir 'latest-smoke'
& (Join-Path $root 'install.ps1') install --channel $channel
& (Join-Path $root 'manage.ps1') install --channel $channel --retain=false
& (Join-Path $env:FLAVOR_LOCAL_BIN_DIR 'flavor.exe') --version
& (Join-Path $env:FLAVOR_LOCAL_BIN_DIR 'flavor.exe') check --root $root --config (Join-Path $root 'flavor.json')
& (Join-Path $root 'uninstall.ps1') --install-root $env:FLAVOR_INSTALL_ROOT
& (Join-Path $root 'manage.ps1') uninstall --install-root $env:FLAVOR_INSTALL_ROOT
if (Test-Path $env:FLAVOR_INSTALL_ROOT) {
throw "full uninstall left $env:FLAVOR_INSTALL_ROOT"
}
Expand Down
8 changes: 4 additions & 4 deletions .github/scripts/release/smoke/smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ export FLAVOR_INSTALL_ROOT="$tmpdir/install"
export FLAVOR_LOCAL_BIN_DIR="$tmpdir/bin"
mkdir -p "$HOME" "$FLAVOR_INSTALL_ROOT" "$FLAVOR_LOCAL_BIN_DIR"

sh "$ROOT/install.sh" install --channel "$CHANNEL" --version "$VERSION"
sh "$ROOT/manage.sh" install --channel "$CHANNEL" --version "$VERSION" --retain=false
"$FLAVOR_LOCAL_BIN_DIR/flavor" --version
"$FLAVOR_LOCAL_BIN_DIR/flavor" check --root "$ROOT" --config "$ROOT/flavor.json"
sh "$ROOT/uninstall.sh" --version "$VERSION"
sh "$ROOT/manage.sh" uninstall --version "$VERSION"
[ ! -e "$FLAVOR_INSTALL_ROOT/$VERSION" ] || { printf '%s\n' "version uninstall left $FLAVOR_INSTALL_ROOT/$VERSION" >&2; exit 1; }

if [ "${SMOKE_LATEST:-}" = "1" ]; then
rm -f "$FLAVOR_LOCAL_BIN_DIR/flavor"
rm -rf "$FLAVOR_INSTALL_ROOT/latest-smoke"
sh "$ROOT/install.sh" install --channel "$CHANNEL" --install-root "$FLAVOR_INSTALL_ROOT/latest-smoke"
sh "$ROOT/manage.sh" install --channel "$CHANNEL" --install-root "$FLAVOR_INSTALL_ROOT/latest-smoke" --retain=false
"$FLAVOR_LOCAL_BIN_DIR/flavor" --version
"$FLAVOR_LOCAL_BIN_DIR/flavor" check --root "$ROOT" --config "$ROOT/flavor.json"
sh "$ROOT/uninstall.sh" --install-root "$FLAVOR_INSTALL_ROOT/latest-smoke"
sh "$ROOT/manage.sh" uninstall --install-root "$FLAVOR_INSTALL_ROOT/latest-smoke"
[ ! -e "$FLAVOR_INSTALL_ROOT/latest-smoke" ] || { printf '%s\n' "full uninstall left $FLAVOR_INSTALL_ROOT/latest-smoke" >&2; exit 1; }
fi
11 changes: 5 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ management.
- `scripts/init.py` is the idempotent post-clone initializer. It quick-fails on
missing required tools or repository entrypoints, installs local hooks, and
exits cleanly only when the checkout is ready for development.
- `install.sh`, `install.ps1`, `uninstall.sh`, and `uninstall.ps1` are the
public install/uninstall entrypoints at the repository root.
- Release and installer downloads use R2 metadata and artifacts as the source of
- `manage.sh` and `manage.ps1` are the public install/uninstall entrypoints at
the repository root.
- Release and manager downloads use R2 metadata and artifacts as the source of
truth.

### Recursive AGENTS Index
Expand Down Expand Up @@ -225,9 +225,8 @@ diagnostics, and typed state/config injection where needed.

### Where Do Installer Changes Go?

Public install/uninstall entrypoints live at the repository root as
`install.sh`, `install.ps1`, `uninstall.sh`, and `uninstall.ps1`. Release and
smoke scripts should reference those root files.
Public install/uninstall entrypoints live at the repository root as `manage.sh`
and `manage.ps1`. Release and smoke scripts should reference those root files.

### Where Do Workflow Helper Scripts Go?

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,49 @@ Personal check-only code flavor lint CLI.
Unix:

```bash
curl -fsSL https://flavor.perish.uk/install.sh | sh
curl -fsSL https://flavor.perish.uk/manage.sh | sh
```

Windows PowerShell:

```powershell
irm https://flavor.perish.uk/install.ps1 | pwsh
irm https://flavor.perish.uk/manage.ps1 | pwsh
```

Pin a version:

```bash
curl -fsSL https://flavor.perish.uk/install.sh | sh -s -- --version v0.1.0
curl -fsSL https://flavor.perish.uk/manage.sh | sh -s -- install --version v0.1.0
```

Install the latest beta:

```bash
curl -fsSL https://flavor.perish.uk/install.sh | sh -s -- --channel beta
curl -fsSL https://flavor.perish.uk/manage.sh | sh -s -- install --channel beta
```

Keep older installed versions instead of prompting or pruning:

```bash
curl -fsSL https://flavor.perish.uk/manage.sh | sh -s -- install --retain=true
```

Uninstall every installed version:

```bash
curl -fsSL https://flavor.perish.uk/uninstall.sh | sh
curl -fsSL https://flavor.perish.uk/manage.sh | sh -s -- uninstall
```

Windows PowerShell:

```powershell
irm https://flavor.perish.uk/uninstall.ps1 | pwsh
& ([scriptblock]::Create((irm https://flavor.perish.uk/manage.ps1))) uninstall
```

Uninstall one version:

```bash
curl -fsSL https://flavor.perish.uk/uninstall.sh | sh -s -- --version v0.2.2
curl -fsSL https://flavor.perish.uk/manage.sh | sh -s -- uninstall --version v0.2.2
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion crates/flavor-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "flavor-cli"
version = "0.3.0"
version = "0.3.1"
edition = "2021"
license = "MIT"
description = "Personal check-only AST-backed code flavor lint CLI."
Expand Down
Loading