Use zip-release action instead of bash script

This commit is contained in:
2024-10-03 03:41:31 -05:00
parent b981c99c9f
commit 8b45059ffc

View File

@@ -78,56 +78,35 @@ jobs:
- name: Run tests - name: Run tests
run: cargo test --verbose run: cargo test --verbose
- name: Export Package Version - name: Export Release Version
run: echo "PACKAGE_VERSION=$(grep '^version = ' Cargo.toml | sed 's/version = \"\(.*\)\"/\1/')" >> $GITHUB_ENV run: echo "RELEASE_VERSION=$(grep '^version = ' Cargo.toml | sed 's/version = \"\(.*\)\"/\1/')" >> $GITHUB_ENV
shell: sh shell: sh
- name: Package Artifacts - name: Archive
shell: bash if: ${{ !contains(matrix.os, 'windows') }}
run: | uses: TheDoctor0/zip-release@0.7.6
src=$(pwd) with:
stage= type: tar
case $RUNNER_OS in filename: spotify-player-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz
Linux) directory: target/${{ matrix.target }}/release/
stage=$(mktemp -d) path: |
;; spotify-player-quickauth
macOS)
stage=$(mktemp -d -t tmp)
;;
esac
RELEASE_VERSION=v${{ env.PACKAGE_VERSION }}
ARCHIVE="spotify-player-quickauth-$RELEASE_VERSION-${{ matrix.target }}"
if [[ "$RUNNER_OS" == "Windows" ]]; then
ARCHIVE="$ARCHIVE.zip"
cp target/${{ matrix.target }}/release/spotify-player-quickauth.exe ./
tar czf "$ARCHIVE" ./spotify-player-quickauth.exe
else
ARCHIVE="$ARCHIVE.tar.gz"
cp target/${{ matrix.target }}/release/spotify-player-quickauth ./
tar czf "$ARCHIVE" ./spotify-player-quickauth
fi
echo "ARCHIVE_PATH=$(pwd)/$ARCHIVE" >> $GITHUB_ENV - name: Archive
if: ${{ contains(matrix.os, 'windows') }}
- name: List all files uses: TheDoctor0/zip-release@0.7.6
shell: bash with:
run: find "$(dirname "${{ env.ARCHIVE_PATH }}")" -type f type: zip
filename: spotify-player-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.zip
- name: Verify Archive directory: target/${{ matrix.target }}/release/
shell: bash path: |
run: | spotify-player-quickauth.exe
if [ ! -f "${{ env.ARCHIVE_PATH }}" ]; then
echo "Error: Archive file not found!"
exit 1
fi
- name: Release - name: Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
files: ./*.{zip,tar.gz} files: spotify-player-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.*
generate_release_notes: true generate_release_notes: true
fail_on_unmatched_files: true fail_on_unmatched_files: true