diff --git a/.github/workflows/sign.yml b/.github/workflows/sign.yml new file mode 100644 index 00000000..24c32d67 --- /dev/null +++ b/.github/workflows/sign.yml @@ -0,0 +1,37 @@ +# This is a basic workflow to help you get started with Actions + +name: Sign + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + release: + types: [released] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Invoke release signing + - name: make it run + run: chmod +x $GITHUB_WORKSPACE/release/requestsign_github.sh + + # Invoke release signing + - name: make it run + run: chmod +x $GITHUB_WORKSPACE/release/requestsign.sh + + # Invoke release signing + - name: Invoke release signing + env: + SIGN_SERVICE_PASSWORD: ${{ secrets.SIGN_SERVICE_PASSWORD }} + SIGN_SERIVCE_URL: ${{ secrets.SIGN_SERIVCE_URL }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: $GITHUB_WORKSPACE/release/requestsign_github.sh \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6e2949c9..d1ccf6ad 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -119,6 +119,10 @@ jobs: GITHUB_TOKEN: $(GITHUB_TOKEN) PRERELEASE: true RELEASE_TAG: unstable-$(Build.SourceVersion) + RELEASE_SHA: $(Build.SourceVersion) + TRIGGER_REASON: $(Build.SourceBranch) + GITHUB_REPO_OWNER: v2fly + GITHUB_REPO_NAME: v2ray-core - script: | cd ./src/v2ray.com/core echo $RELEASE_TAG diff --git a/release/bleedingrelease.sh b/release/bleedingrelease.sh index c46ce860..6176c7b9 100755 --- a/release/bleedingrelease.sh +++ b/release/bleedingrelease.sh @@ -1,13 +1,12 @@ #!/bin/bash - RELBODY="https://www.v2ray.com/chapter_00/01_versions.html" JSON_DATA=$(echo "{}" | jq -c ".tag_name=\"${RELEASE_TAG}\"") JSON_DATA=$(echo ${JSON_DATA} | jq -c ".prerelease=${PRERELEASE}") JSON_DATA=$(echo ${JSON_DATA} | jq -c ".body=\"${RELBODY}\"") RELEASE_DATA=$(curl --data "${JSON_DATA}" -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/v2fly/V2FlyBleedingEdgeBinary/releases) echo $RELEASE_DATA -RELEASE_ID=$(echo $RELEASE_DATA| jq ".id") +RELEASE_ID=$(echo $RELEASE_DATA | jq ".id") function uploadfile() { FILE=$1 @@ -21,16 +20,48 @@ function uploadfile() { 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 + 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 } ART_ROOT=$GOPATH/src/v2ray.com/core/bazel-bin/release +pushd ${ART_ROOT} +{ + go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen version ${RELEASE_TAG} + go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen project "v2flyunstable" + go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-macos.zip + 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 + go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-windows-arm.zip + go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-arm64.zip + 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 + go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-mips.zip + go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-mipsle.zip + 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 + 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 + go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen sort < Release.unsigned.unsorted > Release.unsigned + + { + echo "Build Finished" + echo "https://github.com/v2fly/V2FlyBleedingEdgeBinary/releases/tag/${RELEASE_TAG}" + } > buildcomment + + go run github.com/xiaokangwang/V2BuildAssist/v2buildutil post commit "${RELEASE_SHA}" < buildcomment +popd + upload ${ART_ROOT}/v2ray-macos.zip upload ${ART_ROOT}/v2ray-windows-64.zip upload ${ART_ROOT}/v2ray-windows-32.zip @@ -51,3 +82,4 @@ 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 +upload ${ART_ROOT}/Release.unsigned diff --git a/release/requestsign.sh b/release/requestsign.sh new file mode 100755 index 00000000..feb65f26 --- /dev/null +++ b/release/requestsign.sh @@ -0,0 +1,28 @@ +#!/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 \ No newline at end of file diff --git a/release/requestsign_github.sh b/release/requestsign_github.sh new file mode 100755 index 00000000..931dce37 --- /dev/null +++ b/release/requestsign_github.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +export SIGN_VERSION=$(cat $GITHUB_EVENT_PATH| jq -r ".release.tag_name") + +echo $SIGN_VERSION \ No newline at end of file diff --git a/release/tagrelease.sh b/release/tagrelease.sh index 355583e9..b1c11e77 100755 --- a/release/tagrelease.sh +++ b/release/tagrelease.sh @@ -54,6 +54,33 @@ function upload() { ART_ROOT=$GOPATH/src/v2ray.com/core/bazel-bin/release + +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" + go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-macos.zip + 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 + go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-windows-arm.zip + go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-arm64.zip + 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 + go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-mips.zip + go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen file v2ray-linux-mipsle.zip + 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 + 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 + go run github.com/xiaokangwang/V2BuildAssist/v2buildutil gen sort < Release.unsigned.unsorted > Release.unsigned + +popd + upload ${ART_ROOT}/v2ray-macos.zip upload ${ART_ROOT}/v2ray-windows-64.zip upload ${ART_ROOT}/v2ray-windows-32.zip @@ -74,3 +101,4 @@ 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 +upload ${ART_ROOT}/Release.unsigned