Deduplicate archive path concatenation in build

This commit is contained in:
2024-10-05 17:10:55 -05:00
parent 1e484dc3b9
commit 18b010762e

View File

@@ -109,8 +109,15 @@ jobs:
cargo test ${{ github.event.inputs.verbose == 'true' && '--verbose' || '' }} --release --target ${{ matrix.target }} cargo test ${{ github.event.inputs.verbose == 'true' && '--verbose' || '' }} --release --target ${{ matrix.target }}
fi fi
- name: Export Release Version - name: Prepare Variables
run: echo "RELEASE_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
if ${{ contains(matrix.os, 'windows') }}; then
echo "ARCHIVE=spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.zip" >> $GITHUB_ENV
else
echo "ARCHIVE=spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz" >> $GITHUB_ENV
fi
echo "ARCHIVE_DIR=target/${{ matrix.target }}/release" >> $GITHUB_ENV
shell: sh shell: sh
- name: Archive - name: Archive
@@ -118,8 +125,8 @@ jobs:
uses: TheDoctor0/zip-release@0.7.6 uses: TheDoctor0/zip-release@0.7.6
with: with:
type: tar type: tar
filename: spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz filename: ${{ env.ARCHIVE }}
directory: target/${{ matrix.target }}/release/ directory: ${{ env.ARCHIVE_DIR }}/
path: | path: |
spotify-quickauth spotify-quickauth
@@ -128,8 +135,8 @@ jobs:
uses: TheDoctor0/zip-release@0.7.6 uses: TheDoctor0/zip-release@0.7.6
with: with:
type: zip type: zip
filename: spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.zip filename: ${{ env.ARCHIVE }}
directory: target/${{ matrix.target }}/release/ directory: ${{ env.ARCHIVE_DIR }}/
path: | path: |
spotify-quickauth.exe spotify-quickauth.exe
@@ -140,14 +147,14 @@ jobs:
name: spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }} name: spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}
if-no-files-found: error if-no-files-found: error
retention-days: 7 retention-days: 7
path: target/${{ matrix.target }}/release/spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.* path: ${{ env.ARCHIVE_DIR }}/${{ env.ARCHIVE }}
- 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: | files: |
target/${{ matrix.target }}/release/spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.* ${{ env.ARCHIVE_DIR }}/${{ env.ARCHIVE }}
generate_release_notes: true generate_release_notes: true
# Publish flow # Publish flow