Skip to content

Commit 76fad43

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 76fad43

4 files changed

Lines changed: 31 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: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,14 @@ 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+
# bash/MSYS on Windows mangles PATH when spawning native subprocesses, so
67+
# `sccache` alone is not found there; use the absolute path the action exports.
68+
if [ -n "$SCCACHE_PATH" ]; then
69+
export RUSTC_WRAPPER="$SCCACHE_PATH"
70+
fi
71+
6572
if [ -n "$TARGET" ]; then
6673
rustup toolchain install stable --target "$TARGET" --profile minimal --no-self-update
6774
rustup target add "$TARGET"
@@ -79,23 +86,34 @@ fi
7986
[tasks.zip-release-ci-flow]
8087
description = "Complete release build and packaging"
8188
depends = ["build-release-for-target"]
89+
shell = "bash -c"
8290
run = """
8391
DIST_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version')
8492
DIST_NAME="kubectl-view-allocations_${DIST_VERSION}-${TARGET:-x86_64-unknown-linux-gnu}"
85-
DIST_EXT="tar.gz"
8693
DIST_PATH="target/dist/${DIST_NAME}"
8794
95+
BIN_NAME="kubectl-view-allocations"
96+
DIST_EXT="tar.gz"
97+
case "$TARGET" in
98+
*windows*) BIN_NAME="kubectl-view-allocations.exe"; DIST_EXT="zip" ;;
99+
esac
100+
88101
rm -rf "${DIST_PATH}"
89102
mkdir -p "${DIST_PATH}"
90103
91104
if [ -n "$TARGET" ]; then
92-
cp target/${TARGET}/release/kubectl-view-allocations "${DIST_PATH}/"
105+
cp "target/${TARGET}/release/${BIN_NAME}" "${DIST_PATH}/"
93106
else
94-
cp target/release/kubectl-view-allocations "${DIST_PATH}/"
107+
cp "target/release/${BIN_NAME}" "${DIST_PATH}/"
95108
fi
96109
97110
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"
111+
if [ "$DIST_EXT" = "zip" ]; then
112+
# use PowerShell's built-in Compress-Archive: `zip`/7z are not guaranteed on the runner
113+
powershell.exe -NoProfile -Command "Compress-Archive -Path '${DIST_PATH}/${BIN_NAME}','${DIST_PATH}/LICENSE.txt' -DestinationPath '${DIST_PATH}.${DIST_EXT}' -Force"
114+
else
115+
tar -czvf "${DIST_PATH}.${DIST_EXT}" -C "${DIST_PATH}" "${BIN_NAME}" "LICENSE.txt"
116+
fi
99117
echo "Created: ${DIST_PATH}.${DIST_EXT}"
100118
101119
if [ -n "$GITHUB_OUTPUT" ]; then

0 commit comments

Comments
 (0)