Skip to content

Commit

Permalink
rename script tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
abrenneke committed Aug 29, 2023
1 parent 78ab69b commit 2a6d2e7
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/rename-release-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,35 @@ on:
release:
types:
- published
- edited

jobs:
rename:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Get list of release assets
id: assets
run: |
assets=$(curl --header "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
--url https://api.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets \
| jq -r '.[] | .browser_download_url')
echo "::set-output name=urls::$assets"
echo "urls=$assets" >> $GITHUB_OUTPUT
- name: Download, rename and re-upload release assets
run: |
for url in ${{ steps.assets.outputs.urls }}; do
file=$(basename $url)
if [[ $file == Rivet_*_universal.dmg || $file == Rivet_*_amd64.AppImage || $file == Rivet_*_amd64.deb ]]; then
wget $url
new_file=$(echo $file | sed 's/_.*//').${file##*.}
mv $file $new_file
gh release upload ${{ github.event.release.tag_name }} $new_file --clobber
fi
case $file in
Rivet_*_universal.dmg|Rivet_*_amd64.AppImage|Rivet_*_amd64.deb)
wget --header="Authorization: token ${{ secrets.GITHUB_TOKEN }}" $url
new_file=$(echo $file | sed 's/_.*//').${file##*.}
mv $file $new_file
gh release upload ${{ github.event.release.tag_name }} $new_file --clobber
;;
esac
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 2a6d2e7

Please sign in to comment.