@@ -3,13 +3,7 @@ name: Release
33on :
44 push :
55 tags : ["v*"]
6- workflow_dispatch :
7- inputs :
8- tag :
9- description : ' Tag to release'
10- required : false
11- default : ' v0.0.0'
12-
6+
137permissions :
148 contents : write
159
3933 target : x86_64-pc-windows-msvc
4034 asset_name : windows
4135 arch : x86_64
42-
4336 env :
44- # Construct the binary name with ".exe" if on Windows
4537 BINARY_NAME : keywatch-${{ matrix.platform.asset_name }}-${{ matrix.platform.arch }}${{ matrix.platform.os == 'windows-latest' && '.exe' || '' }}
4638
4739 steps :
6759 with :
6860 targets : ${{ matrix.platform.target }}
6961
70- # When targeting aarch64-apple-darwin, ensure the target is added.
71- # Note: macOS runners already have clang so we do not need a custom linker.
72- - name : Install cross-compilation tools
62+ - name : Add aarch64 Apple target
7363 if : matrix.platform.target == 'aarch64-apple-darwin'
74- run : |
75- brew install FiloSottile/musl-cross/musl-cross || true
76- rustup target add aarch64-apple-darwin
64+ run : rustup target add aarch64-apple-darwin
7765
7866 # Build the specific package
7967 - name : Build Binary
@@ -87,15 +75,21 @@ jobs:
8775 cp target/${{ matrix.platform.target }}/release/key-watch${{ matrix.platform.os == 'windows-latest' && '.exe' || '' }} \
8876 release/${{ env.BINARY_NAME }}
8977
90- # Create checksum
91- - name : Generate SHA-256
78+ # Windows: Generate checksum using cmd and Windows syntax.
79+ - name : Generate SHA-256 (Windows)
80+ if : matrix.platform.os == 'windows-latest'
81+ shell : cmd
82+ run : |
83+ cd release
84+ certutil -hashfile %BINARY_NAME% SHA256 | findstr /V "hash" > %BINARY_NAME%.sha256
85+
86+ # Unix (macOS/Ubuntu): Generate checksum using bash.
87+ - name : Generate SHA-256 (Unix)
88+ if : matrix.platform.os != 'windows-latest'
89+ shell : bash
9290 run : |
9391 cd release
94- if [ "${{ matrix.platform.os }}" = "windows-latest" ]; then
95- certutil -hashfile ${{ env.BINARY_NAME }} SHA256 | grep -v "hash" > ${{ env.BINARY_NAME }}.sha256
96- else
97- shasum -a 256 ${{ env.BINARY_NAME }} > ${{ env.BINARY_NAME }}.sha256
98- fi
92+ shasum -a 256 "$BINARY_NAME" > "$BINARY_NAME".sha256
9993
10094 # Create Release
10195 - name : Create Release
0 commit comments