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 }} - name: Archive
ARCHIVE="spotify-player-quickauth-$RELEASE_VERSION-${{ matrix.target }}" if: ${{ contains(matrix.os, 'windows') }}
uses: TheDoctor0/zip-release@0.7.6
if [[ "$RUNNER_OS" == "Windows" ]]; then with:
ARCHIVE="$ARCHIVE.zip" type: zip
cp target/${{ matrix.target }}/release/spotify-player-quickauth.exe ./ filename: spotify-player-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.zip
tar czf "$ARCHIVE" ./spotify-player-quickauth.exe directory: target/${{ matrix.target }}/release/
else path: |
ARCHIVE="$ARCHIVE.tar.gz" spotify-player-quickauth.exe
cp target/${{ matrix.target }}/release/spotify-player-quickauth ./
tar czf "$ARCHIVE" ./spotify-player-quickauth
fi
echo "ARCHIVE_PATH=$(pwd)/$ARCHIVE" >> $GITHUB_ENV
- name: List all files
shell: bash
run: find "$(dirname "${{ env.ARCHIVE_PATH }}")" -type f
- name: Verify Archive
shell: bash
run: |
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