2020-10-07 08:04:09 -04:00
|
|
|
#!/usr/bin/env bash
|
2019-10-30 03:03:29 -04:00
|
|
|
|
|
|
|
CONST_refs="refs"
|
|
|
|
|
|
|
|
TRIGGER_REASON_A=${TRIGGER_REASON:0:${#CONST_refs}}
|
|
|
|
|
2020-10-07 02:29:07 -04:00
|
|
|
if [ $TRIGGER_REASON_A != $CONST_refs ]; then
|
2019-10-30 03:03:29 -04:00
|
|
|
echo "not a tag: $TRIGGER_REASON_A"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
CONST_refsB="refs/tags/"
|
|
|
|
|
|
|
|
TRIGGER_REASON_B=${TRIGGER_REASON:0:${#CONST_refsB}}
|
|
|
|
|
2020-10-07 02:29:07 -04:00
|
|
|
if [ $TRIGGER_REASON_B != $CONST_refsB ]; then
|
2019-10-30 03:53:04 -04:00
|
|
|
echo "not a tag (B)"
|
2019-10-30 03:03:29 -04:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2020-07-03 02:55:31 -04:00
|
|
|
GITHUB_RELEASE_TAG=${TRIGGER_REASON:${#CONST_refsB}:25}
|
2019-10-30 03:03:29 -04:00
|
|
|
|
|
|
|
echo ${GITHUB_RELEASE_TAG}
|
|
|
|
|
|
|
|
RELEASE_DATA=$(curl -H "Authorization: token ${GITHUB_TOKEN}" -X GET https://api.github.com/repos/v2fly/v2ray-core/releases/tags/${GITHUB_RELEASE_TAG})
|
|
|
|
echo $RELEASE_DATA
|
2020-10-07 02:29:07 -04:00
|
|
|
RELEASE_ID=$(echo $RELEASE_DATA | jq ".id")
|
2019-10-30 03:03:29 -04:00
|
|
|
|
2019-10-30 05:04:17 -04:00
|
|
|
echo $RELEASE_ID
|
|
|
|
|
2019-10-30 03:03:29 -04:00
|
|
|
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
|
2020-10-07 02:29:07 -04:00
|
|
|
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
|
2019-10-30 03:03:29 -04:00
|
|
|
uploadfile $FILE
|
|
|
|
uploadfile $DGST
|
|
|
|
}
|
|
|
|
|
2020-10-07 02:29:07 -04:00
|
|
|
ART_ROOT=${WORKDIR}/bazel-bin/release
|
2020-07-02 08:27:34 -04:00
|
|
|
|
|
|
|
pushd ${ART_ROOT}
|
|
|
|
{
|
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen version "${GITHUB_RELEASE_TAG}"
|
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen project "v2fly"
|
2020-07-18 22:40:33 -04:00
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-macos-64.zip
|
2020-07-02 08:27:34 -04:00
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-windows-64.zip
|
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-windows-32.zip
|
2020-07-18 22:40:33 -04:00
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-windows-arm32-v7a.zip
|
2020-07-03 08:31:17 -04:00
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-64.zip
|
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-32.zip
|
2020-07-18 22:40:33 -04:00
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-arm64-v8a.zip
|
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-arm32-v7a.zip
|
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-arm32-v6.zip
|
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-arm32-v5.zip
|
2020-07-02 08:27:34 -04:00
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-mips64.zip
|
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-mips64le.zip
|
2020-07-18 22:40:33 -04:00
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-mips32.zip
|
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-mips32le.zip
|
2020-07-02 08:27:34 -04:00
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-ppc64.zip
|
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-ppc64le.zip
|
2020-07-19 16:51:39 -04:00
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-riscv64.zip
|
2020-07-02 08:27:34 -04:00
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-s390x.zip
|
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-freebsd-64.zip
|
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-freebsd-32.zip
|
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-openbsd-64.zip
|
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-openbsd-32.zip
|
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-dragonfly-64.zip
|
|
|
|
} >Release.unsigned.unsorted
|
2020-10-07 02:29:07 -04:00
|
|
|
go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen sort <Release.unsigned.unsorted >Release.unsigned
|
2020-07-02 08:27:34 -04:00
|
|
|
|
|
|
|
popd
|
|
|
|
|
2020-07-18 22:40:33 -04:00
|
|
|
upload ${ART_ROOT}/v2ray-macos-64.zip
|
2019-10-30 03:03:29 -04:00
|
|
|
upload ${ART_ROOT}/v2ray-windows-64.zip
|
|
|
|
upload ${ART_ROOT}/v2ray-windows-32.zip
|
2020-07-18 22:40:33 -04:00
|
|
|
upload ${ART_ROOT}/v2ray-windows-arm32-v7a.zip
|
2019-10-30 03:03:29 -04:00
|
|
|
upload ${ART_ROOT}/v2ray-linux-64.zip
|
|
|
|
upload ${ART_ROOT}/v2ray-linux-32.zip
|
2020-07-18 22:40:33 -04:00
|
|
|
upload ${ART_ROOT}/v2ray-linux-arm64-v8a.zip
|
|
|
|
upload ${ART_ROOT}/v2ray-linux-arm32-v7a.zip
|
|
|
|
upload ${ART_ROOT}/v2ray-linux-arm32-v6.zip
|
|
|
|
upload ${ART_ROOT}/v2ray-linux-arm32-v5.zip
|
2019-10-30 03:03:29 -04:00
|
|
|
upload ${ART_ROOT}/v2ray-linux-mips64.zip
|
|
|
|
upload ${ART_ROOT}/v2ray-linux-mips64le.zip
|
2020-07-18 22:40:33 -04:00
|
|
|
upload ${ART_ROOT}/v2ray-linux-mips32.zip
|
|
|
|
upload ${ART_ROOT}/v2ray-linux-mips32le.zip
|
2019-10-30 03:03:29 -04:00
|
|
|
upload ${ART_ROOT}/v2ray-linux-ppc64.zip
|
|
|
|
upload ${ART_ROOT}/v2ray-linux-ppc64le.zip
|
2020-07-19 16:51:39 -04:00
|
|
|
upload ${ART_ROOT}/v2ray-linux-riscv64.zip
|
2019-10-30 03:03:29 -04:00
|
|
|
upload ${ART_ROOT}/v2ray-linux-s390x.zip
|
|
|
|
upload ${ART_ROOT}/v2ray-freebsd-64.zip
|
|
|
|
upload ${ART_ROOT}/v2ray-freebsd-32.zip
|
|
|
|
upload ${ART_ROOT}/v2ray-openbsd-64.zip
|
|
|
|
upload ${ART_ROOT}/v2ray-openbsd-32.zip
|
|
|
|
upload ${ART_ROOT}/v2ray-dragonfly-64.zip
|
2020-07-02 08:27:34 -04:00
|
|
|
upload ${ART_ROOT}/Release.unsigned
|