Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Arqu committed Apr 24, 2024
1 parent e6943dc commit 8139bb0
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,9 @@ jobs:
for BIN_NAME in "${BIN_NAMES[@]}"; do
staging="$BIN_NAME-${{ needs.create-release.outputs.release_version }}-${{ matrix.cargo_targets }}"
mkdir -p "$staging"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp "target/${{ matrix.cargo_targets }}/optimized-release/$BIN_NAME.exe" "$staging/"
cd "$staging"
zip -r "../$staging.zip" .
ASSETS+="$staging.zip,"
cd ..
else
cp "target/${{ matrix.cargo_targets }}/optimized-release/$BIN_NAME" "$staging/"
tar czf "$staging.tar.gz" -C "$staging" .
ASSETS+="$staging.tar.gz,"
fi
cp "target/${{ matrix.cargo_targets }}/optimized-release/$BIN_NAME" "$staging/"
tar czf "$staging.tar.gz" -C "$staging" .
ASSETS+="$staging.tar.gz,"
done
echo "ASSET=$(echo $ASSETS | sed 's/,$//')" >> $GITHUB_ENV
Expand Down Expand Up @@ -263,7 +255,7 @@ jobs:
run: sudo apt update && sudo apt install -y file

- name: Upload release archives
if: github.event.inputs.upload_artifacts == 'true' || github.event_name == 'push'
if: matrix.os != 'windows-latest' && (github.event.inputs.upload_artifacts == 'true' || github.event_name == 'push')
shell: bash
run: |
IFS=',' read -ra ASSETS <<< "${{ env.ASSET }}"
Expand All @@ -276,4 +268,22 @@ jobs:
"${{ needs.create-release.outputs.upload_url }}=$ASSET_NAME"
done
- name: Upload release archives
if: matrix.os == 'windows-latest' && (github.event.inputs.upload_artifacts == 'true' || github.event_name == 'push')
shell: pwsh
run: |
$ASSETS = "${{ env.ASSET }}".Split(',')
foreach ($ASSET in $ASSETS) {
$ASSET_NAME = Split-Path $ASSET -Leaf
$contentType = [System.Web.MimeMapping]::GetMimeMapping($ASSET)
Invoke-RestMethod `
-Headers @{
"Authorization" = "token ${{ secrets.GITHUB_TOKEN }}"
"Content-Type" = $contentType
} `
-InFile $ASSET `
-Method Post `
-Uri "${{ needs.create-release.outputs.upload_url }}=$ASSET_NAME"
}

0 comments on commit 8139bb0

Please sign in to comment.