-
Notifications
You must be signed in to change notification settings - Fork 4
/
release-package.sh
executable file
·28 lines (23 loc) · 1023 Bytes
/
release-package.sh
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
#!/bin/bash
set -x
CURL_RETRIES="--connect-timeout 60 --retry 5 --retry-delay 5"
#Get mpv latest commit sha
short_sha=$(cat /d/msys64/opt/mpv/SHORT_SHA)
date=$(date +%Y-%m-%d)
#Release note
body="Bump to mpv-player/mpv@${short_sha}\n"
body+="**Compiler**: $COMPILER"
curl -u $GITHUB_ACTOR:$GH_TOKEN $CURL_RETRIES \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${GITHUB_REPOSITORY}/releases \
-d '{"tag_name":"'"$date"'","name":"'"$date"'","body":"'"$body"'"}'
release_id=$(curl -u $GITHUB_ACTOR:$GH_TOKEN $CURL_RETRIES \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/$date | jq -r '.id')
for f in *.7z; do
curl -u $GITHUB_ACTOR:$GH_TOKEN $CURL_RETRIES \
-X POST -H "Accept: application/vnd.github.v3+json" \
-H "Content-Type: $(file -b --mime-type $f)" \
https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/$release_id/assets?name=$(basename $f) --data-binary @$f;
done