@@ -26,26 +26,35 @@ jobs:
2626 # # macOS: aarch64, x86_64
2727 - target : aarch64-apple-darwin
2828 os : macos-latest
29+ bin_ext : " "
2930 - target : x86_64-apple-darwin
3031 os : macos-latest
32+ bin_ext : " "
3133 # # Linux:
3234 # # Linux: aarch64, x86_64
3335 - target : aarch64-unknown-linux-gnu
3436 os : ubuntu-latest
37+ bin_ext : " "
3538 - target : aarch64-unknown-linux-musl
3639 os : ubuntu-latest
40+ bin_ext : " "
3741 - target : x86_64-unknown-linux-gnu
3842 os : ubuntu-latest
43+ bin_ext : " "
3944 - target : x86_64-unknown-linux-musl
4045 os : ubuntu-latest
46+ bin_ext : " "
4147 # # Windows: x86_64
4248 - target : x86_64-pc-windows-msvc
4349 os : windows-latest
50+ bin_ext : " .exe"
4451 - target : x86_64-pc-windows-gnu
4552 os : windows-latest
53+ bin_ext : " .exe"
4654 # FreeBSD: x86_64
4755 - target : x86_64-unknown-freebsd
4856 os : ubuntu-latest
57+ bin_ext : " "
4958 runs-on : ${{ matrix.os }}
5059 steps :
5160 - uses : actions/checkout@v4
@@ -65,34 +74,20 @@ jobs:
6574 if : " !startsWith(matrix.os, 'ubuntu')"
6675 run : cargo build --release --locked --target ${{ matrix.target }}
6776
68- - name : Prepare dist
77+ - name : Prepare release binary
78+ id : prepare
6979 shell : bash
7080 run : |
7181 mkdir -p dist
72- cp "target/${{ matrix.target }}/release/diff-coverage" dist/
73- cp README.md dist/
74-
75- - name : Package (tar.gz)
76- if : runner.os != 'Windows'
77- shell : bash
78- run : |
79- archive="diff-coverage-${{ github.ref_name }}-${{ matrix.target }}.tar.gz"
80- tar -czf "$archive" -C dist .
81- echo "archive=$archive" >> "$GITHUB_OUTPUT"
82-
83- - name : Package (zip)
84- if : runner.os == 'Windows'
85- shell : pwsh
86- run : |
87- $archive = "diff-coverage-${{ github.ref_name }}-${{ matrix.target }}.zip"
88- Compress-Archive -Path dist\* -DestinationPath $archive
89- "archive=$archive" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
82+ asset="diff-coverage-${{ github.ref_name }}-${{ matrix.target }}${{ matrix.bin_ext }}"
83+ cp "target/${{ matrix.target }}/release/diff-coverage${{ matrix.bin_ext }}" "dist/$asset"
84+ echo "asset=dist/$asset" >> "$GITHUB_OUTPUT"
9085
9186 - name : Upload release assets
9287 uses : softprops/action-gh-release@v2
9388 with :
9489 files : |
95- diff-coverage- ${{ github.ref_name }}-${{ matrix.target }}.*
90+ ${{ steps.prepare.outputs.asset }}
9691
9792 publish :
9893 runs-on : ubuntu-latest
@@ -107,4 +102,4 @@ jobs:
107102 id : auth
108103 - run : cargo publish
109104 env :
110- CARGO_REGISTRY_TOKEN : ${{ steps.auth.outputs.token }}
105+ CARGO_REGISTRY_TOKEN : ${{ steps.auth.outputs.token }}
0 commit comments