Repository: imsnif/bandwhich (language: rust)

Issue:
bandwhich-v0.23.0-x86_64-pc-windows-msvc.zip seems to be broken
I can't unarchive the zip file [bandwhich-v0.23.0-x86_64-pc-windows-msvc.zip](https://github.com/imsnif/bandwhich/releases/download/v0.23.0/bandwhich-v0.23.0-x86_64-pc-windows-msvc.zip) by `unzip` command.

https://github.com/imsnif/bandwhich/releases/tag/v0.23.0

```console
$ unzip bandwhich-v0.23.0-x86_64-pc-windows-msvc.zip 
Archive:  bandwhich-v0.23.0-x86_64-pc-windows-msvc.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of bandwhich-v0.23.0-x86_64-pc-windows-msvc.zip or
        bandwhich-v0.23.0-x86_64-pc-windows-msvc.zip.zip, and cannot find bandwhich-v0.23.0-x86_64-pc-windows-msvc.zip.ZIP, period.

$ echo $?
9
```

## Environment

MacBookPro: Apple M3 Pro
macOS Sonoma 14.6.1

```console
$ unzip -V
UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.

Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
  Default action is to extract files in list, except those in xlist, to exdir;
  file[.zip] may be a wildcard.  -Z => ZipInfo mode ("unzip -Z" for usage).

  -p  extract files to pipe, no messages     -l  list files (short format)
  -f  freshen existing files, create none    -t  test compressed archive data
  -u  update files, create if necessary      -z  display archive comment only
  -v  list verbosely/show version info       -T  timestamp archive to latest
  -x  exclude files that follow (in xlist)   -d  extract files into exdir
modifiers:
  -n  never overwrite existing files         -q  quiet mode (-qq => quieter)
  -o  overwrite files WITHOUT prompting      -a  auto-convert any text files
  -j  junk paths (do not make directories)   -aa treat ALL files as text
  -C  match filenames case-insensitively     -L  make (some) names lowercase
  -X  restore UID/GID info                   -V  retain VMS version numbers
  -K  keep setuid/setgid/tacky permissions   -M  pipe through "more" pager
See "unzip -hh" or unzip.txt for more help.  Examples:
  unzip data1 -x joe   => extract all files except joe from zipfile data1.zip
  unzip -p foo | more  => send contents of foo.zip via pipe into program more
  unzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer
```


Discussion / hints:
yes, 7zip also gives an error

![Untitled](https://github.com/user-attachments/assets/835ff1dd-9afd-42a0-be23-cd7ce26eb1a9)

![archive file type](https://github.com/user-attachments/assets/a9c5c975-17ac-42b4-b6b7-65c02bcf4134)

Oops. I mistakenly thought the `tar.exe` that ships with Windows can also handle zip files:

https://github.com/imsnif/bandwhich/blob/eb7496791137645f7cffda700a52b3d19c4761a9/.github/workflows/release.yaml#L144-L148

Turns out no; it just creates a TAR archive and names it `NAME.zip`. But [Ark](https://apps.kde.org/en-gb/ark/) sees it (correctly) as a TAR archive despite the name and handles the file accordingly, which is why I failed to notice the discrepancy.

I'll fix CI and replace `bandwhich-v0.23.0-x86_64-pc-windows-msvc.zip`. Meanwhile, you can rename the "fake zip" to `bandwhich-v0.23.0-x86_64-pc-windows-msvc.tar`, then use `tar` or `7zip` to extract.

Fix patch:
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 4d9c99c4..36ba2df8 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -74,7 +74,7 @@ jobs:
           - build: linux-aarch64-musl
             target: aarch64-unknown-linux-musl
             cargo: cross
-          - build: linux-armv7-gnueabihf 
+          - build: linux-armv7-gnueabihf
             target: armv7-unknown-linux-gnueabihf
             cargo: cross
           - build: linux-armv7-musleabihf
@@ -111,7 +111,7 @@ jobs:
         # The latest release of `cross` is not able to build/link for `aarch64-linux-android`
         # See: https://github.com/cross-rs/cross/issues/1222
         # This is fixed on `main` but not yet released. To avoid a breakage somewhen in the future
-        # pin the cross revision used to the latest HEAD at 04/2024. 
+        # pin the cross revision used to the latest HEAD at 04/2024.
         # Go back to taiki-e/install-action once cross 0.3 is released.
         uses: taiki-e/cache-cargo-install-action@v2
         with:
@@ -143,9 +143,8 @@ jobs:
 
       - name: Zip release (Windows)
         if: contains(matrix.os, 'windows')
-        shell: bash
         working-directory: ${{ env.PKGDIR }}
-        run: tar.exe -a -c -f bandwhich-${{ github.ref_name }}-${{ matrix.target }}.zip *
+        run: Compress-Archive -Path * -DestinationPath bandwhich-${{ github.ref_name }}-${{ matrix.target }}.zip
 
       - name: Upload release archive
         uses: actions/upload-release-asset@v1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f9f136d3..dc39fc7c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
 ## [Unreleased]
 
+### Fixed
+
+* CI: Use Powershell Compress-Archive to create Windows binary zip #424 - @cyqsimon
+
 ## [0.23.0] - 2024-08-17
 
 ## Fixed


Test patch: