Skip to content

Commit

Permalink
chore: add zip format in a Windows release assets (#298)
Browse files Browse the repository at this point in the history
Resolves GH-296 without replacing current tar.gz for backward
compatibility

I have tested with similar code, then the workflow uploads files like
https://github.com/kachick/television/releases/tag/0.999.999
  • Loading branch information
kachick authored Jan 20, 2025
1 parent 4dc7c71 commit 5750531
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ jobs:
####### reduce binary size by removing debug symbols #######
BINARY_NAME=${{ matrix.binary-name }}${{ matrix.binary-postfix }}
echo "BINARY_NAME=$BINARY_NAME" >> "$GITHUB_ENV"
if [[ ${{ matrix.target }} == aarch64-unknown-linux-gnu ]]; then
GCC_PREFIX="aarch64-linux-gnu-"
Expand All @@ -115,6 +116,7 @@ jobs:
########## create tar.gz ##########
RELEASE_NAME=${{ matrix.binary-name }}-${GITHUB_REF/refs\/tags\//}-${{ matrix.os-name }}-${{ matrix.architecture }}
echo "RELEASE_NAME=$RELEASE_NAME" >> "$GITHUB_ENV"
tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME
Expand All @@ -126,12 +128,20 @@ jobs:
else
shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256
fi
- name: Packaging with zip format
if: runner.os == 'Windows'
working-directory: 'target/${{ matrix.target }}/release'
run: |
Compress-Archive -Path "$env:BINARY_NAME" -Destination "$($env:RELEASE_NAME).zip"
(Get-FileHash "$($env:RELEASE_NAME).zip" -Algorithm SHA256).Hash.ToLower() > "$($env:RELEASE_NAME).zip.sha256"
- name: Releasing assets
uses: softprops/action-gh-release@v1
with:
files: |
target/${{ matrix.target }}/release/${{ matrix.binary-name }}-*.tar.gz
target/${{ matrix.target }}/release/${{ matrix.binary-name }}-*.zip
target/${{ matrix.target }}/release/${{ matrix.binary-name }}-*.sha256
env:
Expand Down

0 comments on commit 5750531

Please sign in to comment.