1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00
v2fly/release/requestsign.sh
2020-07-03 00:34:15 +08:00

28 lines
938 B
Bash
Executable File

#!/bin/bash
RELEASE_DATA=$(curl --data "version=${SIGN_VERSION}" --data "password=${SIGN_SERVICE_PASSWORD}" -X POST "${SIGN_SERIVCE_URL}" )
echo $RELEASE_DATA
RELEASE_ID=$(echo $RELEASE_DATA| jq -r ".id")
function uploadfile() {
FILE=$1
CTYPE=$(file -b --mime-type $FILE)
sleep 1
curl -H "Authorization: token ${GITHUB_TOKEN}" -H "Content-Type: ${CTYPE}" --data-binary @$FILE "https://uploads.github.com/repos/v2fly/v2ray-core/releases/${RELEASE_ID}/assets?name=$(basename $FILE)"
sleep 1
}
function upload() {
FILE=$1
DGST=$1.dgst
openssl dgst -md5 $FILE | sed 's/([^)]*)//g' >> $DGST
openssl dgst -sha1 $FILE | sed 's/([^)]*)//g' >> $DGST
openssl dgst -sha256 $FILE | sed 's/([^)]*)//g' >> $DGST
openssl dgst -sha512 $FILE | sed 's/([^)]*)//g' >> $DGST
uploadfile $FILE
uploadfile $DGST
}
curl "https://raw.githubusercontent.com/v2fly/Release/master/v2fly/${SIGN_VERSION}.Release" > Release
upload Release