docs(cli): document prerelease install channel

This commit is contained in:
Kayshen-X 2026-07-08 23:28:07 +08:00
parent 4e16c7734f
commit f6f3303635
4 changed files with 50 additions and 4 deletions

View file

@ -159,12 +159,24 @@ Or use the install script (macOS / Linux):
curl -fsSL https://raw.githubusercontent.com/ZSeven-W/openpencil/main/scripts/install-op.sh | bash
```
To allow the newest pre-release:
```bash
curl -fsSL https://raw.githubusercontent.com/ZSeven-W/openpencil/main/scripts/install-op.sh | OP_PRERELEASE=1 bash
```
Windows PowerShell:
```powershell
irm https://raw.githubusercontent.com/ZSeven-W/openpencil/main/scripts/install-op.ps1 | iex
```
To allow the newest pre-release:
```powershell
$env:OP_PRERELEASE = "1"; irm https://raw.githubusercontent.com/ZSeven-W/openpencil/main/scripts/install-op.ps1 | iex
```
## Cloning (with submodules)
```bash
@ -294,10 +306,18 @@ brew install zseven-w/openpencil/op
curl -fsSL https://raw.githubusercontent.com/ZSeven-W/openpencil/main/scripts/install-op.sh | bash
```
```bash
curl -fsSL https://raw.githubusercontent.com/ZSeven-W/openpencil/main/scripts/install-op.sh | OP_PRERELEASE=1 bash
```
```powershell
irm https://raw.githubusercontent.com/ZSeven-W/openpencil/main/scripts/install-op.ps1 | iex
```
```powershell
$env:OP_PRERELEASE = "1"; irm https://raw.githubusercontent.com/ZSeven-W/openpencil/main/scripts/install-op.ps1 | iex
```
```bash
op start # Launch desktop app
op design @landing.txt # Batch design from file

View file

@ -28,12 +28,24 @@ macOS / Linux:
curl -fsSL https://raw.githubusercontent.com/ZSeven-W/openpencil/main/scripts/install-op.sh | bash
```
For the newest pre-release:
```sh
curl -fsSL https://raw.githubusercontent.com/ZSeven-W/openpencil/main/scripts/install-op.sh | OP_PRERELEASE=1 bash
```
Windows PowerShell:
```powershell
irm https://raw.githubusercontent.com/ZSeven-W/openpencil/main/scripts/install-op.ps1 | iex
```
For the newest pre-release:
```powershell
$env:OP_PRERELEASE = "1"; irm https://raw.githubusercontent.com/ZSeven-W/openpencil/main/scripts/install-op.ps1 | iex
```
## Docker
The release workflow publishes the web image to GHCR as:

View file

@ -1,5 +1,6 @@
param(
[string]$OpVersion = $env:OP_VERSION,
[switch]$PreRelease,
[string]$InstallDir = $(if ($env:INSTALL_DIR) { $env:INSTALL_DIR } else { Join-Path $env:USERPROFILE ".openpencil\bin" })
)
@ -19,9 +20,14 @@ function Resolve-Version {
return $DefaultOpVersion.TrimStart("v")
}
$Latest = Invoke-RestMethod -Uri "https://api.github.com/repos/$Owner/$Repo/releases/latest"
$AllowPreRelease = $PreRelease.IsPresent -or $env:OP_PRERELEASE -in @("1", "true", "TRUE", "yes", "YES")
if ($AllowPreRelease) {
$Latest = Invoke-RestMethod -Uri "https://api.github.com/repos/$Owner/$Repo/releases" | Select-Object -First 1
} else {
$Latest = Invoke-RestMethod -Uri "https://api.github.com/repos/$Owner/$Repo/releases/latest"
}
if (-not $Latest.tag_name) {
throw "install-op: could not resolve latest release tag; set OP_VERSION explicitly"
throw "install-op: could not resolve latest release tag; set OP_VERSION explicitly or OP_PRERELEASE=1 to allow pre-release tags"
}
return $Latest.tag_name.TrimStart("v")
}

View file

@ -8,6 +8,7 @@
# Usage:
# ./install-op.sh # install the latest stable release
# OP_VERSION=0.8.0 ./install-op.sh # pin a specific version
# OP_PRERELEASE=1 ./install-op.sh # allow the newest pre-release
# INSTALL_DIR=$HOME/.local/bin ./install-op.sh
#
# The release workflow stamps DEFAULT_OP_VERSION and DEFAULT_SHA_* in the copy
@ -25,6 +26,7 @@ DEFAULT_SHA_MACOS_AARCH64=""
DEFAULT_SHA_MACOS_X86_64=""
DEFAULT_SHA_LINUX_AARCH64=""
DEFAULT_SHA_LINUX_X86_64=""
INSTALL_TMP=""
detect_label() {
local os arch
@ -58,11 +60,16 @@ resolve_version() {
fi
local api tag
api="https://api.github.com/repos/${OWNER}/${REPO}/releases/latest"
if [ "${OP_PRERELEASE:-}" = "1" ] || [ "${OP_PRERELEASE:-}" = "true" ]; then
api="https://api.github.com/repos/${OWNER}/${REPO}/releases"
else
api="https://api.github.com/repos/${OWNER}/${REPO}/releases/latest"
fi
tag="$(curl -fsSL "$api" | grep -o '"tag_name"[[:space:]]*:[[:space:]]*"[^"]*"' | head -n1 | sed 's/.*"\(v\{0,1\}[^"]*\)"$/\1/')"
if [ -z "$tag" ]; then
echo "error: could not resolve the latest release tag from GitHub" >&2
echo " set OP_VERSION explicitly, e.g. OP_VERSION=0.8.0 $0" >&2
echo " or set OP_PRERELEASE=1 to allow pre-release tags" >&2
exit 1
fi
printf '%s' "${tag#v}"
@ -101,7 +108,8 @@ main() {
echo " from ${url}"
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
INSTALL_TMP="$tmp"
trap 'rm -rf "$INSTALL_TMP"' EXIT
curl -fsSL --retry 3 -o "$tmp/${asset}" "$url"
if [ -n "$expected_sha" ]; then