Skip to content

Commit bdfb42c

Browse files
davidBclaude
andcommitted
feat: add windows/amd64 release build and krew platform entry
Adds x86_64-pc-windows-msvc to the release build matrix, packages the Windows binary as .zip (via PowerShell Compress-Archive, per krew-index convention) instead of tar.gz, and registers the windows/amd64 platform in .krew.yaml. Also runs release packaging (zip-release-ci-flow) and the build/test job on windows-latest in CI, and forces bash as the task shell for the two release tasks since mise defaults to cmd on Windows and their scripts use POSIX syntax. Closes #354 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 2a3af6f commit bdfb42c

4 files changed

Lines changed: 35 additions & 5 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
os:
2525
- imageName: ubuntu-latest
2626
- imageName: macOS-latest
27-
# - imageName: windows-latest
27+
- imageName: windows-latest
2828

2929
steps:
3030
- uses: actions/checkout@v7
@@ -34,6 +34,7 @@ jobs:
3434
cache: false
3535
cache_save: false
3636
- run: mise run ci
37+
- run: mise run zip-release-ci-flow
3738
# for list of xcode sdk see https://help.github.com/en/actions/automating-your-workflow-with-github-actions/software-installed-on-github-hosted-runners#xcode
3839
# DEVELOPER_DIR: "/Applications/Xcode_11.app/Contents/Developer"
3940

.github/workflows/release-plz.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ jobs:
7373
- { target_platform: aarch64-unknown-linux-musl, imageName: ubuntu-latest, cross: "true" }
7474
- { target_platform: x86_64-apple-darwin, imageName: macOS-latest }
7575
- { target_platform: aarch64-apple-darwin, imageName: macOS-latest }
76+
- { target_platform: x86_64-pc-windows-msvc, imageName: windows-latest }
7677
steps:
7778
- uses: actions/checkout@v7
7879
with:

.krew.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ spec:
2929
arch: arm64
3030
{{addURIAndSha "https://github.com/davidB/kubectl-view-allocations/releases/download/{{ .TagName }}/kubectl-view-allocations_{{ .TagName }}-aarch64-unknown-linux-musl.tar.gz" .TagName | indent 6}}
3131
bin: "./kubectl-view-allocations"
32+
- selector:
33+
matchLabels:
34+
os: windows
35+
arch: amd64
36+
{{addURIAndSha "https://github.com/davidB/kubectl-view-allocations/releases/download/{{ .TagName }}/kubectl-view-allocations_{{ .TagName }}-x86_64-pc-windows-msvc.zip" .TagName | indent 6}}
37+
bin: "./kubectl-view-allocations.exe"
3238
shortDescription: List allocations per resources, nodes, pods.
3339
homepage: https://github.com/davidB/kubectl-view-allocations
3440
description: |

mise.toml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,16 @@ cargo clippy -- -D warnings
6161
# Build tasks for different targets
6262
[tasks.build-release-for-target]
6363
description = "Build release for specific target"
64+
shell = "bash -c"
6465
run = """
66+
set -euo pipefail
67+
68+
# bash/MSYS on Windows mangles PATH when spawning native subprocesses, so
69+
# `sccache` alone is not found there; use the absolute path the action exports.
70+
if [ -n "$SCCACHE_PATH" ]; then
71+
export RUSTC_WRAPPER="$SCCACHE_PATH"
72+
fi
73+
6574
if [ -n "$TARGET" ]; then
6675
rustup toolchain install stable --target "$TARGET" --profile minimal --no-self-update
6776
rustup target add "$TARGET"
@@ -79,23 +88,36 @@ fi
7988
[tasks.zip-release-ci-flow]
8089
description = "Complete release build and packaging"
8190
depends = ["build-release-for-target"]
91+
shell = "bash -c"
8292
run = """
93+
set -euo pipefail
94+
8395
DIST_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version')
8496
DIST_NAME="kubectl-view-allocations_${DIST_VERSION}-${TARGET:-x86_64-unknown-linux-gnu}"
85-
DIST_EXT="tar.gz"
8697
DIST_PATH="target/dist/${DIST_NAME}"
8798
99+
BIN_NAME="kubectl-view-allocations"
100+
DIST_EXT="tar.gz"
101+
case "${TARGET:-$(uname -s)}" in
102+
*windows*|MINGW*|MSYS*|CYGWIN*) BIN_NAME="kubectl-view-allocations.exe"; DIST_EXT="zip" ;;
103+
esac
104+
88105
rm -rf "${DIST_PATH}"
89106
mkdir -p "${DIST_PATH}"
90107
91108
if [ -n "$TARGET" ]; then
92-
cp target/${TARGET}/release/kubectl-view-allocations "${DIST_PATH}/"
109+
cp "target/${TARGET}/release/${BIN_NAME}" "${DIST_PATH}/"
93110
else
94-
cp target/release/kubectl-view-allocations "${DIST_PATH}/"
111+
cp "target/release/${BIN_NAME}" "${DIST_PATH}/"
95112
fi
96113
97114
cp LICENSE.txt "${DIST_PATH}/" || echo "LICENSE.txt not found"
98-
tar -czvf "${DIST_PATH}.${DIST_EXT}" -C "${DIST_PATH}" "kubectl-view-allocations" "LICENSE.txt"
115+
if [ "$DIST_EXT" = "zip" ]; then
116+
# use PowerShell's built-in Compress-Archive: `zip`/7z are not guaranteed on the runner
117+
powershell.exe -NoProfile -Command "Compress-Archive -Path '${DIST_PATH}/${BIN_NAME}','${DIST_PATH}/LICENSE.txt' -DestinationPath '${DIST_PATH}.${DIST_EXT}' -Force"
118+
else
119+
tar -czvf "${DIST_PATH}.${DIST_EXT}" -C "${DIST_PATH}" "${BIN_NAME}" "LICENSE.txt"
120+
fi
99121
echo "Created: ${DIST_PATH}.${DIST_EXT}"
100122
101123
if [ -n "$GITHUB_OUTPUT" ]; then

0 commit comments

Comments
 (0)