Skip to content

Commit 2a852ce

Browse files
buty4649claude
andauthored
release: リリース成果物に winget manifest を追加 (#39)
* release: リリース成果物に winget manifest を追加 goreleaser の post-build hook で windows/amd64 バイナリから sha256 を計算し winget-manifest.yaml を生成、release.extra_files でリリース資産に含める。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * document: README のインストール手順を OS 別に刷新 Linux/macOS は gh もしくは mise、Windows は winget-manifest 経由でのインストール手順を案内する。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 46cf443 commit 2a852ce

3 files changed

Lines changed: 73 additions & 3 deletions

File tree

.goreleaser.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ builds:
3131
goarch: amd64
3232
- goos: windows
3333
goarch: arm64
34+
hooks:
35+
post:
36+
- cmd: ./scripts/gen-winget-manifest.sh "{{ .Path }}" "{{ .Version }}"
37+
env:
38+
- TARGET={{ .Os }}_{{ .Arch }}
3439

3540
archives:
3641
- formats: [binary]
@@ -53,3 +58,5 @@ changelog:
5358
release:
5459
draft: false
5560
prerelease: auto
61+
extra_files:
62+
- glob: ./dist/winget-manifest.yaml

README.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,44 @@
1313

1414
## インストール
1515

16-
Go 1.26 以降:
16+
### Linux / macOS
17+
18+
[gh](https://cli.github.com/) コマンドを使って最新リリースからバイナリを取得:
19+
20+
```sh
21+
mkdir -p ~/.local/bin
22+
23+
# Linux (amd64)
24+
gh release download --repo pepabo/xpoint-cli --pattern '*_linux_amd64' -O xp
25+
chmod +x xp && mv xp ~/.local/bin/
26+
27+
# macOS (arm64)
28+
gh release download --repo pepabo/xpoint-cli --pattern '*_darwin_arm64' -O xp
29+
chmod +x xp && xattr -d com.apple.quarantine xp && mv xp ~/.local/bin/
30+
```
31+
32+
[mise](https://mise.jdx.dev/) を使う場合:
1733

1834
```sh
19-
go install github.com/pepabo/xpoint-cli@latest
35+
mise use -g github:pepabo/xpoint-cli@latest
2036
```
2137

22-
または [GitHub Releases](https://github.com/pepabo/xpoint-cli/releases) からバイナリを取得。
38+
### Windows
39+
40+
PowerShell で最新リリースの `winget-manifest.yaml` をダウンロードし、`winget install --manifest` でインストール:
41+
42+
```powershell
43+
Invoke-WebRequest -Uri https://github.com/pepabo/xpoint-cli/releases/latest/download/winget-manifest.yaml -OutFile winget-manifest.yaml
44+
winget install --manifest winget-manifest.yaml
45+
```
46+
47+
> [!NOTE]
48+
> `--manifest` を使うには `winget settings` でローカルマニフェストを有効化する必要があります。
49+
> 管理者権限の PowerShell で `winget settings --enable LocalManifestFiles` を実行してください。
50+
51+
### バイナリを直接ダウンロード
52+
53+
[GitHub Releases](https://github.com/pepabo/xpoint-cli/releases) から対応するバイナリを取得してください。
2354

2455
## 認証
2556

scripts/gen-winget-manifest.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if [[ "${TARGET:-}" != "windows_amd64" ]]; then
5+
exit 0
6+
fi
7+
8+
binary_path="${1:?binary path required}"
9+
version="${2:?version required}"
10+
output="${3:-dist/winget-manifest.yaml}"
11+
12+
checksum=$(sha256sum "$binary_path" | awk '{print $1}')
13+
14+
mkdir -p "$(dirname "$output")"
15+
16+
cat > "$output" <<EOF
17+
PackageIdentifier: Pepabo.xpoint-cli
18+
PackageVersion: ${version}
19+
PackageLocale: ja-JP
20+
Publisher: GMO Pepabo Inc,
21+
PackageName: xpoint-cli
22+
License: MIT
23+
ShortDescription: cli tool for X-point
24+
Installers:
25+
- Architecture: x64
26+
InstallerType: portable
27+
InstallerUrl: https://github.com/pepabo/xpoint-cli/releases/download/v${version}/xp_${version}_windows_amd64.exe
28+
InstallerSha256: ${checksum}
29+
Commands: [ xp ]
30+
ManifestType: singleton
31+
ManifestVersion: 1.12.0
32+
EOF

0 commit comments

Comments
 (0)