From 659afdc69cde2e0a134714044cde458ff3bfc464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Fernando?= Date: Fri, 19 Dec 2025 18:27:44 +0000 Subject: [PATCH 1/4] feat: add DevContainer and Taskfile for release automation --- .devcontainer/devcontainer.json | 50 ++++++++++ .devcontainer/setup.sh | 30 ++++++ .gitignore | 4 +- README.md | 24 ++++- Taskfile.yml | 157 ++++++++++++++++++++++++++++++++ 5 files changed, 263 insertions(+), 2 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/setup.sh create mode 100644 Taskfile.yml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..0b8ac23 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,50 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/go . +{ + "name": "Go", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/go:2-1.25-trixie", + + // Features to add to the dev container. More info: https://containers.dev/features. + "features": { + "ghcr.io/devcontainers/features/go:1": {}, + "ghcr.io/guiyomh/features/golangci-lint:0": {}, + "ghcr.io/guiyomh/features/goreleaser:0": {} + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "openai.chatgpt", + "golang.Go" + ], + "settings": { + // Slightly different dark theme to highlight the DevContainer + "workbench.colorTheme": "Default Dark Modern", + "workbench.colorCustomizations": { + "statusBar.background": "#005f73", + "statusBar.noFolderBackground": "#005f73", + "statusBar.debuggingBackground": "#9b2226", + "statusBar.foreground": "#ffffff" + } + } + } + }, + + // Preserve global host configurations within the container: git, codex-extension. + "mounts": [ + "source=codex-session,target=/home/vscode/.codex,type=volume", + "source=${localEnv:USERPROFILE}${localEnv:HOME}/.gitconfig,target=/tmp/gitconfig,type=bind,consistency=cached", + "source=${localEnv:USERPROFILE}${localEnv:HOME}/.git-credential,target=/tmp/git-credential,type=bind,consistency=cached" + ], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "./.devcontainer/setup.sh", + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + "remoteUser": "vscode" +} diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100644 index 0000000..fad8a2f --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -euo pipefail + +if ! command -v task >/dev/null; then + echo "Installing Taskfile CLI helper..." >&2 + curl -1sLf 'https://dl.cloudsmith.io/public/task/task/setup.deb.sh' | sudo -E bash + sudo apt install task +fi + +sudo chown -R ${UID}:${UID} /home/vscode/.codex + +if [ -f /tmp/gitconfig ]; then + cp /tmp/gitconfig /home/vscode/.gitconfig + sudo chown -R ${UID}:${UID} /home/vscode/.gitconfig + # sudo chmod 644 /home/vscode/.gitconfig +fi + +if [ -f /tmp/git-credential ]; then + cp /tmp/git-credential /home/vscode/.git-credential + sudo chown -R ${UID}:${UID} /home/vscode/.git-credential + # sudo find /home/vscode/.git-credential -type d -exec chmod 755 {} + + # sudo find /home/vscode/.git-credential -type f -exec chmod 644 {} + +fi + +# Fix project file permissions to standard privileges +sudo chown -R ${UID}:${UID} ${PWD} +sudo find ${PWD} -type d -exec chmod 755 {} + +sudo find ${PWD} -type f -exec chmod 644 {} + + +git config --global --add safe.directory ${PWD} diff --git a/.gitignore b/.gitignore index 7cbe6c2..e35a94a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .idea/ -hapi \ No newline at end of file +hapi +bin/ +dist/ \ No newline at end of file diff --git a/README.md b/README.md index 8520cc6..b00bb7e 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,28 @@ hapi vps vm list See the [full reference documentation](https://github.com/hostinger/api-cli/blob/main/docs/hapi.md) for information about each available command. +# Building from source + +If you need to compile `hapi` yourself, the repository ships with a `Taskfile.yml` that automates downloading dependencies, cross-building every supported platform, packaging the binaries, and generating release-style checksums. + +Inside the repository, install [`Task CLI`](https://taskfile.dev) or use the [devcontainer](https://containers.dev) terminal, then run: + +```bash +task clean # remove previous artifacts +task release # builds linux/darwin/windows binaries and tarballs + checksums +task install # detects GOOS/GOARCH, builds native binary under dist/host/-/ +``` + +Each tarball is created under `dist/` with the pattern `hapi---.tar.gz`, and the native host binary lands at `dist/host/-/hapi`. + +You can also build a single target manually if you prefer: + +```bash +GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o hapi main.go +``` + +Finally, copy the resulting binary into your `$PATH` or package it for the target device. + # Enabling shell auto-completion (optional) `hapi` has auto-complete support. This makes it easier to use the CLI and improves user experience by completing command @@ -59,4 +81,4 @@ Auto-completion can be generated for multiple shells. The currently supported sh After adding shell auto-completion, remember to refresh your shell profile by logging out from the shell and log back in. -Read more on [how to enable auto-completion](https://github.com/hostinger/api-cli/blob/main/AUTOCOMPLETE.md). \ No newline at end of file +Read more on [how to enable auto-completion](https://github.com/hostinger/api-cli/blob/main/AUTOCOMPLETE.md). diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..49287b4 --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,157 @@ +version: '3' + +env: + DIST_DIR: dist + BINARY: hapi + LDFLAGS: -s -w + +tasks: + default: + desc: List the available tasks without executing any of them. + silent: true + cmds: + - task --list + + clean: + desc: Remove previously generated artifacts. + cmds: + - rm -rf ${DIST_DIR} + + ensure: + desc: Download Go modules before building. + cmds: + - go mod download + + build: + desc: Build the CLI for the host platform. + deps: [ensure] + cmds: + - mkdir -p ${DIST_DIR}/host + - go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/host/${BINARY} main.go + + build.linux-amd64: + desc: Build Linux amd64 binary. + deps: [ensure] + cmds: + - mkdir -p ${DIST_DIR}/linux-amd64 + - GOOS=linux GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/linux-amd64/${BINARY} main.go + + build.linux-arm64: + desc: Build Linux arm64 binary. + deps: [ensure] + cmds: + - mkdir -p ${DIST_DIR}/linux-arm64 + - GOOS=linux GOARCH=arm64 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/linux-arm64/${BINARY} main.go + + build.darwin-amd64: + desc: Build macOS amd64 binary. + deps: [ensure] + cmds: + - mkdir -p ${DIST_DIR}/darwin-amd64 + - GOOS=darwin GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/darwin-amd64/${BINARY} main.go + + build.darwin-arm64: + desc: Build macOS arm64 binary. + deps: [ensure] + cmds: + - mkdir -p ${DIST_DIR}/darwin-arm64 + - GOOS=darwin GOARCH=arm64 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/darwin-arm64/${BINARY} main.go + + build.linux-386: + desc: Build Linux 386 binary. + deps: [ensure] + cmds: + - mkdir -p ${DIST_DIR}/linux-386 + - GOOS=linux GOARCH=386 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/linux-386/${BINARY} main.go + + build.windows-386: + desc: Build Windows 386 binary. + deps: [ensure] + cmds: + - mkdir -p ${DIST_DIR}/windows-386 + - GOOS=windows GOARCH=386 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/windows-386/${BINARY} main.go + + build.windows-amd64: + desc: Build Windows amd64 binary. + deps: [ensure] + cmds: + - mkdir -p ${DIST_DIR}/windows-amd64 + - GOOS=windows GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/windows-amd64/${BINARY} main.go + + build.windows-arm64: + desc: Build Windows arm64 binary. + deps: [ensure] + cmds: + - mkdir -p ${DIST_DIR}/windows-arm64 + - GOOS=windows GOARCH=arm64 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/windows-arm64/${BINARY} main.go + + package.linux-amd64: + desc: Package the Linux amd64 binary into a tarball. + deps: [build.linux-amd64] + cmds: + - sh -c 'version=$(git describe --tags --abbrev=0); tar czf ${DIST_DIR}/${BINARY}-$version-linux-amd64.tar.gz -C ${DIST_DIR}/linux-amd64 ${BINARY}' + + package.linux-arm64: + desc: Package the Linux arm64 binary into a tarball. + deps: [build.linux-arm64] + cmds: + - sh -c 'version=$(git describe --tags --abbrev=0); tar czf ${DIST_DIR}/${BINARY}-$version-linux-arm64.tar.gz -C ${DIST_DIR}/linux-arm64 ${BINARY}' + + package.darwin-arm64: + desc: Package the macOS arm64 binary into a tarball. + deps: [build.darwin-arm64] + cmds: + - sh -c 'version=$(git describe --tags --abbrev=0); tar czf ${DIST_DIR}/${BINARY}-$version-darwin-arm64.tar.gz -C ${DIST_DIR}/darwin-arm64 ${BINARY}' + + package.darwin-amd64: + desc: Package the macOS amd64 binary into a tarball. + deps: [build.darwin-amd64] + cmds: + - sh -c 'version=$(git describe --tags --abbrev=0); tar czf ${DIST_DIR}/${BINARY}-$version-darwin-amd64.tar.gz -C ${DIST_DIR}/darwin-amd64 ${BINARY}' + + package.linux-386: + desc: Package the Linux 386 binary into a tarball. + deps: [build.linux-386] + cmds: + - sh -c 'version=$(git describe --tags --abbrev=0); tar czf ${DIST_DIR}/${BINARY}-$version-linux-386.tar.gz -C ${DIST_DIR}/linux-386 ${BINARY}' + + package.windows-386: + desc: Package the Windows 386 binary into a tarball. + deps: [build.windows-386] + cmds: + - sh -c 'version=$(git describe --tags --abbrev=0); tar czf ${DIST_DIR}/${BINARY}-$version-windows-386.tar.gz -C ${DIST_DIR}/windows-386 ${BINARY}' + + package.windows-amd64: + desc: Package the Windows amd64 binary into a tarball. + deps: [build.windows-amd64] + cmds: + - sh -c 'version=$(git describe --tags --abbrev=0); tar czf ${DIST_DIR}/${BINARY}-$version-windows-amd64.tar.gz -C ${DIST_DIR}/windows-amd64 ${BINARY}' + + package.windows-arm64: + desc: Package the Windows arm64 binary into a tarball. + deps: [build.windows-arm64] + cmds: + - sh -c 'version=$(git describe --tags --abbrev=0); tar czf ${DIST_DIR}/${BINARY}-$version-windows-arm64.tar.gz -C ${DIST_DIR}/windows-arm64 ${BINARY}' + + packages: + desc: Package every platform bundle. + deps: + - package.darwin-amd64 + - package.darwin-arm64 + - package.linux-386 + - package.linux-amd64 + - package.linux-arm64 + - package.windows-386 + - package.windows-amd64 + - package.windows-arm64 + + package.checksums: + desc: Create SHA256 checksums for every release tarball. + deps: [packages] + cmds: + - sh -c 'version=$(git describe --tags --abbrev=0); cd ${DIST_DIR}; sha256sum ${BINARY}-$version-*.tar.gz > ${BINARY}-$version-checksums.sha256' + + release: + desc: Build and package every target used for releases. + deps: + - package.checksums From c080bdc3d4b27f8d51d8baa06cb4e9d2cc4fde55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Fernando?= Date: Fri, 19 Dec 2025 18:39:15 +0000 Subject: [PATCH 2/4] feat: add DevContainer and Taskfile for release automation --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b00bb7e..e6893a8 100644 --- a/README.md +++ b/README.md @@ -47,21 +47,25 @@ See the [full reference documentation](https://github.com/hostinger/api-cli/blob # Building from source -If you need to compile `hapi` yourself, the repository ships with a `Taskfile.yml` that automates downloading dependencies, cross-building every supported platform, packaging the binaries, and generating release-style checksums. +If you need to compile `hapi` yourself, the repository ships with a `Taskfile.yml` that automates downloading dependencies, cross-building every supported platform and packaging the binaries. Inside the repository, install [`Task CLI`](https://taskfile.dev) or use the [devcontainer](https://containers.dev) terminal, then run: ```bash task clean # remove previous artifacts -task release # builds linux/darwin/windows binaries and tarballs + checksums -task install # detects GOOS/GOARCH, builds native binary under dist/host/-/ +task release # builds linux/darwin/windows binaries ``` Each tarball is created under `dist/` with the pattern `hapi---.tar.gz`, and the native host binary lands at `dist/host/-/hapi`. You can also build a single target manually if you prefer: +```bash +# a binary for you device +go build -ldflags="-s -w" -o hapi main.go +``` ```bash +# or for specific arch GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o hapi main.go ``` From 601662d197d00f99c301828d0893e257b98d76ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Fernando?= Date: Fri, 19 Dec 2025 21:12:42 +0000 Subject: [PATCH 3/4] issue(coderabbit): applying coderabbit-ai suggestions --- .devcontainer/devcontainer.json | 5 ++--- .devcontainer/setup.sh | 31 +++++++++++++++---------------- README.md | 2 +- Taskfile.yml | 24 ++++++++++++------------ 4 files changed, 30 insertions(+), 32 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0b8ac23..8802dd7 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -35,11 +35,10 @@ } }, - // Preserve global host configurations within the container: git, codex-extension. + // Preserve the packages configurations within the container on a host volume: git, codex-extension. "mounts": [ "source=codex-session,target=/home/vscode/.codex,type=volume", - "source=${localEnv:USERPROFILE}${localEnv:HOME}/.gitconfig,target=/tmp/gitconfig,type=bind,consistency=cached", - "source=${localEnv:USERPROFILE}${localEnv:HOME}/.git-credential,target=/tmp/git-credential,type=bind,consistency=cached" + "source=gitconfig,target=/home/vscode/.gitconfig-volume,type=volume" ], // Use 'postCreateCommand' to run commands after the container is created. diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index fad8a2f..34966c8 100644 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -4,27 +4,26 @@ set -euo pipefail if ! command -v task >/dev/null; then echo "Installing Taskfile CLI helper..." >&2 curl -1sLf 'https://dl.cloudsmith.io/public/task/task/setup.deb.sh' | sudo -E bash - sudo apt install task + sudo apt install -y task fi -sudo chown -R ${UID}:${UID} /home/vscode/.codex - -if [ -f /tmp/gitconfig ]; then - cp /tmp/gitconfig /home/vscode/.gitconfig - sudo chown -R ${UID}:${UID} /home/vscode/.gitconfig - # sudo chmod 644 /home/vscode/.gitconfig -fi - -if [ -f /tmp/git-credential ]; then - cp /tmp/git-credential /home/vscode/.git-credential - sudo chown -R ${UID}:${UID} /home/vscode/.git-credential - # sudo find /home/vscode/.git-credential -type d -exec chmod 755 {} + - # sudo find /home/vscode/.git-credential -type f -exec chmod 644 {} + -fi +sudo chown -R ${UID}:${UID} ${HOME}/.codex # Fix project file permissions to standard privileges sudo chown -R ${UID}:${UID} ${PWD} sudo find ${PWD} -type d -exec chmod 755 {} + -sudo find ${PWD} -type f -exec chmod 644 {} + +sudo find ${PWD} -type f ! -name "*.sh" -exec chmod 644 {} + +sudo find ${PWD} -type f -name "*.sh" -exec chmod 755 {} + + +# Setup git files configurations +sudo chown -R ${UID}:${UID} ${HOME}/.gitconfig-volume + +touch ${HOME}/.gitconfig-volume/config +ln -fs ${HOME}/.gitconfig-volume/config ${HOME}/.gitconfig +sudo chown -R ${UID}:${UID} ${HOME}/.gitconfig + +mkdir -p ${HOME}/.gitconfig-volume/.git-credentials +ln -fs ${HOME}/.gitconfig-volume/.git-credentials ${HOME}/.git-credentials +sudo chown -R ${UID}:${UID} ${HOME}/.git-credentials git config --global --add safe.directory ${PWD} diff --git a/README.md b/README.md index e6893a8..01be951 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Each tarball is created under `dist/` with the pattern `hapi---.t You can also build a single target manually if you prefer: ```bash -# a binary for you device +# a binary for your device go build -ldflags="-s -w" -o hapi main.go ``` diff --git a/Taskfile.yml b/Taskfile.yml index 49287b4..5b2d930 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -69,69 +69,69 @@ tasks: deps: [ensure] cmds: - mkdir -p ${DIST_DIR}/windows-386 - - GOOS=windows GOARCH=386 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/windows-386/${BINARY} main.go + - GOOS=windows GOARCH=386 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/windows-386/${BINARY}.exe main.go build.windows-amd64: desc: Build Windows amd64 binary. deps: [ensure] cmds: - mkdir -p ${DIST_DIR}/windows-amd64 - - GOOS=windows GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/windows-amd64/${BINARY} main.go + - GOOS=windows GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/windows-amd64/${BINARY}.exe main.go build.windows-arm64: desc: Build Windows arm64 binary. deps: [ensure] cmds: - mkdir -p ${DIST_DIR}/windows-arm64 - - GOOS=windows GOARCH=arm64 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/windows-arm64/${BINARY} main.go + - GOOS=windows GOARCH=arm64 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/windows-arm64/${BINARY}.exe main.go package.linux-amd64: desc: Package the Linux amd64 binary into a tarball. deps: [build.linux-amd64] cmds: - - sh -c 'version=$(git describe --tags --abbrev=0); tar czf ${DIST_DIR}/${BINARY}-$version-linux-amd64.tar.gz -C ${DIST_DIR}/linux-amd64 ${BINARY}' + - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-linux-amd64.tar.gz -C ${DIST_DIR}/linux-amd64 ${BINARY}' package.linux-arm64: desc: Package the Linux arm64 binary into a tarball. deps: [build.linux-arm64] cmds: - - sh -c 'version=$(git describe --tags --abbrev=0); tar czf ${DIST_DIR}/${BINARY}-$version-linux-arm64.tar.gz -C ${DIST_DIR}/linux-arm64 ${BINARY}' + - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-linux-arm64.tar.gz -C ${DIST_DIR}/linux-arm64 ${BINARY}' package.darwin-arm64: desc: Package the macOS arm64 binary into a tarball. deps: [build.darwin-arm64] cmds: - - sh -c 'version=$(git describe --tags --abbrev=0); tar czf ${DIST_DIR}/${BINARY}-$version-darwin-arm64.tar.gz -C ${DIST_DIR}/darwin-arm64 ${BINARY}' + - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-darwin-arm64.tar.gz -C ${DIST_DIR}/darwin-arm64 ${BINARY}' package.darwin-amd64: desc: Package the macOS amd64 binary into a tarball. deps: [build.darwin-amd64] cmds: - - sh -c 'version=$(git describe --tags --abbrev=0); tar czf ${DIST_DIR}/${BINARY}-$version-darwin-amd64.tar.gz -C ${DIST_DIR}/darwin-amd64 ${BINARY}' + - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-darwin-amd64.tar.gz -C ${DIST_DIR}/darwin-amd64 ${BINARY}' package.linux-386: desc: Package the Linux 386 binary into a tarball. deps: [build.linux-386] cmds: - - sh -c 'version=$(git describe --tags --abbrev=0); tar czf ${DIST_DIR}/${BINARY}-$version-linux-386.tar.gz -C ${DIST_DIR}/linux-386 ${BINARY}' + - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-linux-386.tar.gz -C ${DIST_DIR}/linux-386 ${BINARY}' package.windows-386: desc: Package the Windows 386 binary into a tarball. deps: [build.windows-386] cmds: - - sh -c 'version=$(git describe --tags --abbrev=0); tar czf ${DIST_DIR}/${BINARY}-$version-windows-386.tar.gz -C ${DIST_DIR}/windows-386 ${BINARY}' + - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-windows-386.tar.gz -C ${DIST_DIR}/windows-386 ${BINARY}' package.windows-amd64: desc: Package the Windows amd64 binary into a tarball. deps: [build.windows-amd64] cmds: - - sh -c 'version=$(git describe --tags --abbrev=0); tar czf ${DIST_DIR}/${BINARY}-$version-windows-amd64.tar.gz -C ${DIST_DIR}/windows-amd64 ${BINARY}' + - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-windows-amd64.tar.gz -C ${DIST_DIR}/windows-amd64 ${BINARY}' package.windows-arm64: desc: Package the Windows arm64 binary into a tarball. deps: [build.windows-arm64] cmds: - - sh -c 'version=$(git describe --tags --abbrev=0); tar czf ${DIST_DIR}/${BINARY}-$version-windows-arm64.tar.gz -C ${DIST_DIR}/windows-arm64 ${BINARY}' + - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-windows-arm64.tar.gz -C ${DIST_DIR}/windows-arm64 ${BINARY}' packages: desc: Package every platform bundle. @@ -149,7 +149,7 @@ tasks: desc: Create SHA256 checksums for every release tarball. deps: [packages] cmds: - - sh -c 'version=$(git describe --tags --abbrev=0); cd ${DIST_DIR}; sha256sum ${BINARY}-$version-*.tar.gz > ${BINARY}-$version-checksums.sha256' + - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); cd ${DIST_DIR}; sha256sum ${BINARY}-$version-*.tar.gz > ${BINARY}-$version-checksums.sha256' release: desc: Build and package every target used for releases. From ba7749c52734dc4815a7027c3d7d6b4a3d9e1336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Fernando?= Date: Fri, 19 Dec 2025 21:42:21 +0000 Subject: [PATCH 4/4] issue(coderabbit): applying coderabbit-ai suggestions, revision 2 --- .devcontainer/setup.sh | 2 +- Taskfile.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index 34966c8..5f54b56 100644 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -22,7 +22,7 @@ touch ${HOME}/.gitconfig-volume/config ln -fs ${HOME}/.gitconfig-volume/config ${HOME}/.gitconfig sudo chown -R ${UID}:${UID} ${HOME}/.gitconfig -mkdir -p ${HOME}/.gitconfig-volume/.git-credentials +touch ${HOME}/.gitconfig-volume/.git-credentials ln -fs ${HOME}/.gitconfig-volume/.git-credentials ${HOME}/.git-credentials sudo chown -R ${UID}:${UID} ${HOME}/.git-credentials diff --git a/Taskfile.yml b/Taskfile.yml index 5b2d930..9dd963a 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -119,19 +119,19 @@ tasks: desc: Package the Windows 386 binary into a tarball. deps: [build.windows-386] cmds: - - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-windows-386.tar.gz -C ${DIST_DIR}/windows-386 ${BINARY}' + - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-windows-386.tar.gz -C ${DIST_DIR}/windows-386 ${BINARY}.exe' package.windows-amd64: desc: Package the Windows amd64 binary into a tarball. deps: [build.windows-amd64] cmds: - - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-windows-amd64.tar.gz -C ${DIST_DIR}/windows-amd64 ${BINARY}' + - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-windows-amd64.tar.gz -C ${DIST_DIR}/windows-amd64 ${BINARY}.exe' package.windows-arm64: desc: Package the Windows arm64 binary into a tarball. deps: [build.windows-arm64] cmds: - - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-windows-arm64.tar.gz -C ${DIST_DIR}/windows-arm64 ${BINARY}' + - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-windows-arm64.tar.gz -C ${DIST_DIR}/windows-arm64 ${BINARY}.exe' packages: desc: Package every platform bundle.