-
Notifications
You must be signed in to change notification settings - Fork 241
38 lines (34 loc) · 1.22 KB
/
rename-release-assets.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Rename Release Assets
on:
release:
types:
- published
- edited
jobs:
rename:
runs-on: ubuntu-latest
steps:
- name: Checkout code
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 "urls=$assets" >> $GITHUB_OUTPUT
- name: Download, rename and re-upload release assets
run: |
for url in ${{ steps.assets.outputs.urls }}; do
file=$(basename $url)
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 }}