Add one-line installer + install.sh, richer release notes

install.sh detects arch, downloads the latest binary and installs it to PATH
(like a `curl … | sh` installer). The release workflow now ships install.sh as
an asset and PATCHes the release body with the one-line install command, so the
release page shows how to install with a single command. README/wiki updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011YPrEZVBpPVoCRyJz2exkZ
This commit is contained in:
brasse
2026-07-04 14:38:27 +02:00
parent 35f5a86acd
commit e45fb9b4fd
3 changed files with 110 additions and 7 deletions

View File

@@ -63,8 +63,9 @@ jobs:
cargo build --release --target x86_64-unknown-linux-gnu
cp target/x86_64-unknown-linux-gnu/release/npmctl dist/npmctl-linux-x64
cp install.sh dist/install.sh
cd dist
sha256sum npmctl-linux-* > checksums.txt
sha256sum npmctl-linux-* install.sh > checksums.txt
ls -la
- name: Skapa Gitea-release + ladda upp assets
@@ -76,11 +77,27 @@ jobs:
run: |
set -eu
B=dist
BODY="npmctl $TAG — CLI för Nginx Proxy Manager (linux x64/arm64). Se wiki: https://gitea.brasse-pc.eu/brasse/Npm-cli/wiki"
rid=$(curl -s -X POST "$API/repos/$REPO/releases" -H "Authorization: token $TOKEN" -H 'Content-Type: application/json' -d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"body\":\"$BODY\"}" | jq -r '.id // empty')
BODY=$(cat <<'MD'
`npmctl` — CLI för Nginx Proxy Manager (NPM) med sudo-liknande token-auth (lösenordet sparas aldrig, bara en kortlivad token) och en generisk `api`-funktion för vilket HTTP-API som helst.
**Installera (en rad):**
```
curl -fsSL https://gitea.brasse-pc.eu/brasse/Npm-cli/raw/branch/main/install.sh | sh
```
Eller ladda ner rätt binär nedan (`npmctl-linux-x64` / `npmctl-linux-arm64`), `chmod +x` och lägg i PATH. Verifiera mot `checksums.txt`.
📖 Guide: https://gitea.brasse-pc.eu/brasse/Npm-cli/wiki
MD
)
payload=$(jq -n --arg tag "$TAG" --arg body "$BODY" '{tag_name:$tag,name:$tag,body:$body}')
rid=$(curl -s -X POST "$API/repos/$REPO/releases" -H "Authorization: token $TOKEN" -H 'Content-Type: application/json' -d "$payload" | jq -r '.id // empty')
[ -z "$rid" ] && rid=$(curl -s "$API/repos/$REPO/releases/tags/$TAG" -H "Authorization: token $TOKEN" | jq -r '.id')
echo "release id: $rid"
for f in npmctl-linux-x64 npmctl-linux-arm64 checksums.txt; do
# Uppdatera namn/beskrivning även om releasen redan fanns (rullande 'latest').
curl -s -X PATCH "$API/repos/$REPO/releases/$rid" -H "Authorization: token $TOKEN" -H 'Content-Type: application/json' \
-d "$(jq -n --arg tag "$TAG" --arg body "$BODY" '{name:$tag,body:$body}')" -o /dev/null
for f in npmctl-linux-x64 npmctl-linux-arm64 install.sh checksums.txt; do
aid=$(curl -s "$API/repos/$REPO/releases/$rid/assets" -H "Authorization: token $TOKEN" | jq -r ".[] | select(.name==\"$f\") | .id")
if [ -n "$aid" ] && [ "$aid" != "null" ]; then
echo "ersätter befintlig $f (id $aid)"