deduplicate release check condition

This commit is contained in:
2024-10-05 17:15:16 -05:00
parent 6599f58933
commit d533a4318e

View File

@@ -119,6 +119,7 @@ jobs:
echo "ARCHIVE=spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz" >> $GITHUB_ENV echo "ARCHIVE=spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz" >> $GITHUB_ENV
fi fi
echo "ARCHIVE_DIR=target/${{ matrix.target }}/release" >> $GITHUB_ENV echo "ARCHIVE_DIR=target/${{ matrix.target }}/release" >> $GITHUB_ENV
echo "IS_RELEASE=${{startsWith(github.ref, 'refs/tags/')}}" >> $GITHUB_ENV
shell: sh shell: sh
- name: Archive - name: Archive
@@ -142,11 +143,13 @@ jobs:
spotify-quickauth.exe spotify-quickauth.exe
- name: Install rsign2 - name: Install rsign2
if: env.IS_RELEASE
uses: taiki-e/install-action@v2 uses: taiki-e/install-action@v2
with: with:
tool: rsign2 tool: rsign2
- name: Sign Archive - name: Sign Archive
if: env.IS_RELEASE
env: env:
ARCHIVE_PATH: ${{ env.ARCHIVE_DIR }}/${{ env.ARCHIVE }} ARCHIVE_PATH: ${{ env.ARCHIVE_DIR }}/${{ env.ARCHIVE }}
run: | run: |
@@ -159,7 +162,7 @@ jobs:
rsign sign -W -s minisign.key -x "${{ env.ARCHIVE_PATH }}.sig" -t "$comment" "${{ env.ARCHIVE_PATH }}" rsign sign -W -s minisign.key -x "${{ env.ARCHIVE_PATH }}.sig" -t "$comment" "${{ env.ARCHIVE_PATH }}"
- name: Upload Artifact - name: Upload Artifact
if: ${{ !startsWith(github.ref, 'refs/tags/') }} if: !env.IS_RELEASE
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }} name: spotify-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}
@@ -169,7 +172,7 @@ jobs:
- name: Release - name: Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/') if: env.IS_RELEASE
with: with:
files: | files: |
${{ env.ARCHIVE_DIR }}/${{ env.ARCHIVE }} ${{ env.ARCHIVE_DIR }}/${{ env.ARCHIVE }}
@@ -177,9 +180,9 @@ jobs:
generate_release_notes: true generate_release_notes: true
- name: cargo login - name: cargo login
if: startsWith(github.ref, 'refs/tags/') if: env.IS_RELEASE
run: cargo login ${{ secrets.CRATES_IO_API_TOKEN }} run: cargo login ${{ secrets.CRATES_IO_API_TOKEN }}
- name: "cargo release publish" - name: "cargo release publish"
if: startsWith(github.ref, 'refs/tags/') if: env.IS_RELEASE
run: cargo release publish --workspace --all-features --allow-branch HEAD --no-confirm --no-verify --execute run: cargo release publish --workspace --all-features --allow-branch HEAD --no-confirm --no-verify --execute