fail fast, add job names, add windows handling for .zip & .exe suffix

This commit is contained in:
2024-10-03 02:59:30 -05:00
parent 09694717fc
commit 068844ed27

View File

@@ -26,6 +26,7 @@ env:
jobs: jobs:
build: build:
strategy: strategy:
fail-fast: ${{ startsWith(github.ref, 'refs/tags/') }}
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
@@ -55,7 +56,7 @@ jobs:
toolchain: stable toolchain: stable
targets: ${{ matrix.target }} targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: Install Linker - name: Install Linker
if: matrix.linker if: matrix.linker
run: | run: |
@@ -71,7 +72,8 @@ jobs:
- name: Run tests - name: Run tests
run: cargo test --verbose run: cargo test --verbose
- run: echo "PACKAGE_VERSION=$(grep '^version = ' Cargo.toml | sed 's/version = \"\(.*\)\"/\1/')" >> $GITHUB_ENV - name: Export Package Version
run: echo "PACKAGE_VERSION=$(grep '^version = ' Cargo.toml | sed 's/version = \"\(.*\)\"/\1/')" >> $GITHUB_ENV
shell: sh shell: sh
- name: Package Artifacts - name: Package Artifacts
@@ -88,12 +90,19 @@ jobs:
;; ;;
esac esac
cp target/${{ matrix.target }}/release/spotify-player-quickauth $stage/
cd $stage
RELEASE_VERSION=v${{ env.PACKAGE_VERSION }} RELEASE_VERSION=v${{ env.PACKAGE_VERSION }}
ARCHIVE="spotify-player-quickauth-$RELEASE_VERSION-${{ matrix.target }}.tar.gz" ARCHIVE="spotify-player-quickauth-$RELEASE_VERSION-${{ matrix.target }}"
tar czf "$ARCHIVE" ./spotify-player-quickauth
if [[ "$RUNNER_OS" == "Windows" ]]; then
ARCHIVE="$ARCHIVE.zip"
cp target/${{ matrix.target }}/release/spotify-player-quickauth.exe ./
zip -r "$ARCHIVE" ./spotify-player-quickauth.exe
else
ARCHIVE="$ARCHIVE.tar.gz"
cp target/${{ matrix.target }}/release/spotify-player-quickauth.exe ./
tar czf "$ARCHIVE" ./spotify-player-quickauth
fi
echo "ARCHIVE_PATH=$(pwd)/$ARCHIVE" >> $GITHUB_ENV echo "ARCHIVE_PATH=$(pwd)/$ARCHIVE" >> $GITHUB_ENV
- name: Release - name: Release