mirror of
https://github.com/logos-storage/logos-storage-go-bindings.git
synced 2026-01-02 13:33:10 +00:00
Merge pull request #11 from codex-storage/chore/release-note
chore: enhance release note
This commit is contained in:
commit
643a9cbd0e
67
RELEASE.md
67
RELEASE.md
@ -27,3 +27,70 @@ Once published, the artifacts can be downloaded using the `version`, example:
|
||||
|
||||
It is not recommended to use the `latest` URL because you may face cache issues.
|
||||
|
||||
## Integration
|
||||
|
||||
Once released, you can integrate it into your Go project using:
|
||||
|
||||
```bash
|
||||
go get github.com/codex-storage/codex-go-bindings@v0.0.26
|
||||
```
|
||||
|
||||
Then you can use the following `Makefile` command to fetch the artifact:
|
||||
|
||||
```bash
|
||||
LIBS_DIR := $(abspath ./libs)
|
||||
CODEX_OS := linux
|
||||
CODEX_ARCH := amd64
|
||||
CODEX_VERSION := $(shell go list -m -f '{{.Version}}' github.com/codex-storage/codex-go-bindings 2>/dev/null)
|
||||
CODEX_DOWNLOAD_URL := "https://github.com/codex-storage/codex-go-bindings/releases/download/$(CODEX_VERSION)/codex-${CODEX_OS}-${CODEX_ARCH}.zip"
|
||||
|
||||
fetch-libcodex:
|
||||
mkdir -p $(LIBS_DIR); \
|
||||
curl -fSL --create-dirs -o $(LIBS_DIR)/codex-${CODEX_OS}-${CODEX_ARCH}.zip ${CODEX_DOWNLOAD_URL}; \
|
||||
unzip -o -qq $(LIBS_DIR)/codex-${CODEX_OS}-${CODEX_ARCH}.zip -d $(LIBS_DIR); \
|
||||
rm -f $(LIBS_DIR)/codex*.zip;
|
||||
```
|
||||
|
||||
`CODEX_VERSION` uses the same version as the Codex Go dependency declared in your project.
|
||||
|
||||
### Nix
|
||||
|
||||
If you use Nix in a sandboxed environment, you cannot use curl to download the artifacts, so you have to prefetch them using the artifacts `SHA-256` hash. To generate the hash, you can use the following command:
|
||||
|
||||
```bash
|
||||
nix store prefetch-file --json --unpack https://github.com/codex-storage/codex-go-bindings/releases/download/v0.0.26/codex-macos-arm64.zip | jq -r .hash
|
||||
|
||||
# [10.4 MiB DL] sha256-3CHIWoSjo0plsYqzXQWm1EtY1STcljV4yfXTPon90uE=
|
||||
```
|
||||
|
||||
Then include this hash in your Nix configuration. For example:
|
||||
|
||||
```nix
|
||||
let
|
||||
optionalString = pkgs.lib.optionalString;
|
||||
codexVersion = "v0.0.26";
|
||||
arch =
|
||||
if stdenv.hostPlatform.isx86_64 then "amd64"
|
||||
else if stdenv.hostPlatform.isAarch64 then "arm64"
|
||||
else stdenv.hostPlatform.arch;
|
||||
os = if stdenv.isDarwin then "macos" else "Linux";
|
||||
hash =
|
||||
if stdenv.hostPlatform.isDarwin
|
||||
# nix store prefetch-file --json --unpack https://github.com/codex-storage/codex-go-bindings/releases/download/v0.0.26/codex-macos-arm64.zip | jq -r .hash
|
||||
then "sha256-3CHIWoSjo0plsYqzXQWm1EtY1STcljV4yfXTPon90uE="
|
||||
# nix store prefetch-file --json --unpack https://github.com/codex-storage/codex-go-bindings/releases/download/v0.0.26/codex-Linux-amd64.zip | jq -r .hash
|
||||
else "sha256-YxW2vFZlcLrOx1PYgWW4MIstH/oFBRF0ooS0sl3v6ig=";
|
||||
|
||||
# Pre-fetch libcodex to avoid network during build
|
||||
codexLib = pkgs.fetchzip {
|
||||
url = "https://github.com/codex-storage/codex-go-bindings/releases/download/${codexVersion}/codex-${os}-${arch}.zip";
|
||||
hash = hash;
|
||||
stripRoot = false;
|
||||
};
|
||||
|
||||
preBuild = ''
|
||||
export LIBS_DIR="${codexLib}"
|
||||
# Build something cool with Codex
|
||||
'';
|
||||
```
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user