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
7 changes: 7 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ builds:
goarch: amd64
- goos: windows
goarch: arm64
hooks:
post:
- cmd: ./scripts/gen-winget-manifest.sh "{{ .Path }}" "{{ .Version }}"
env:
- TARGET={{ .Os }}_{{ .Arch }}

archives:
- formats: [binary]
Expand All @@ -53,3 +58,5 @@ changelog:
release:
draft: false
prerelease: auto
extra_files:
- glob: ./dist/winget-manifest.yaml
37 changes: 34 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,44 @@

## インストール

Go 1.26 以降:
### Linux / macOS

[gh](https://cli.github.com/) コマンドを使って最新リリースからバイナリを取得:

```sh
mkdir -p ~/.local/bin

# Linux (amd64)
gh release download --repo pepabo/xpoint-cli --pattern '*_linux_amd64' -O xp
chmod +x xp && mv xp ~/.local/bin/

# macOS (arm64)
gh release download --repo pepabo/xpoint-cli --pattern '*_darwin_arm64' -O xp
chmod +x xp && xattr -d com.apple.quarantine xp && mv xp ~/.local/bin/
```

[mise](https://mise.jdx.dev/) を使う場合:

```sh
go install github.com/pepabo/xpoint-cli@latest
mise use -g github:pepabo/xpoint-cli@latest
```

または [GitHub Releases](https://github.com/pepabo/xpoint-cli/releases) からバイナリを取得。
### Windows

PowerShell で最新リリースの `winget-manifest.yaml` をダウンロードし、`winget install --manifest` でインストール:

```powershell
Invoke-WebRequest -Uri https://github.com/pepabo/xpoint-cli/releases/latest/download/winget-manifest.yaml -OutFile winget-manifest.yaml
winget install --manifest winget-manifest.yaml
```

> [!NOTE]
> `--manifest` を使うには `winget settings` でローカルマニフェストを有効化する必要があります。
> 管理者権限の PowerShell で `winget settings --enable LocalManifestFiles` を実行してください。

### バイナリを直接ダウンロード

[GitHub Releases](https://github.com/pepabo/xpoint-cli/releases) から対応するバイナリを取得してください。

## 認証

Expand Down
32 changes: 32 additions & 0 deletions scripts/gen-winget-manifest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail

if [[ "${TARGET:-}" != "windows_amd64" ]]; then
exit 0
fi

binary_path="${1:?binary path required}"
version="${2:?version required}"
output="${3:-dist/winget-manifest.yaml}"

checksum=$(sha256sum "$binary_path" | awk '{print $1}')

mkdir -p "$(dirname "$output")"

cat > "$output" <<EOF
PackageIdentifier: Pepabo.xpoint-cli
PackageVersion: ${version}
PackageLocale: ja-JP
Publisher: GMO Pepabo Inc,
PackageName: xpoint-cli
License: MIT
ShortDescription: cli tool for X-point
Installers:
- Architecture: x64
InstallerType: portable
InstallerUrl: https://github.com/pepabo/xpoint-cli/releases/download/v${version}/xp_${version}_windows_amd64.exe
InstallerSha256: ${checksum}
Commands: [ xp ]
ManifestType: singleton
ManifestVersion: 1.12.0
EOF