diff --git a/.github/scripts/upload_bitbucket.sh b/.github/scripts/upload_bitbucket.sh new file mode 100644 index 00000000..76ecbaf6 --- /dev/null +++ b/.github/scripts/upload_bitbucket.sh @@ -0,0 +1,10 @@ +# 工作目录在项目顶级 +# 必须的环境变量: VERSION_NUMBER BITBUCKET_TOKEN + +curl "https://api.bitbucket.org/2.0/repositories/niceleeee/BilibiliDown/downloads" \ + -F "files=@BilibiliDown.v$VERSION_NUMBER.release.zip" \ + -H "Authorization: Bearer $BITBUCKET_TOKEN" + +curl "https://api.bitbucket.org/2.0/repositories/niceleeee/BilibiliDown/downloads" \ + -F "files=@BilibiliDown.v$VERSION_NUMBER.release.zip.sha1" \ + -H "Authorization: Bearer $BITBUCKET_TOKEN" \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 693d18f0..1a02efd3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -93,7 +93,15 @@ jobs: run: | chmod +x .github/scripts/upload_cloudinary.sh ./.github/scripts/upload_cloudinary.sh - + + - name: Upload release to bitbucket + env: + VERSION_NUMBER: ${{ steps.tag_latest.outputs.value }} + BITBUCKET_TOKEN: ${{ secrets.BITBUCKET_TOKEN }} + if: ${{ always() && env.BITBUCKET_TOKEN != '' && github.event.inputs.bitbucket == 'true'}} + run: | + chmod +x .github/scripts/upload_bitbucket.sh + ./.github/scripts/upload_bitbucket.sh - name: Sync Push to Gitee env: diff --git a/.github/workflows/upload-manually.yml b/.github/workflows/upload-manually.yml index b61184b2..099a651e 100644 --- a/.github/workflows/upload-manually.yml +++ b/.github/workflows/upload-manually.yml @@ -16,6 +16,11 @@ on: type: boolean default: true required: false + bitbucket: + description: 'Upload to bitbucket?' + type: boolean + default: true + required: false giteePush: description: 'Push to gitee?' type: boolean @@ -66,7 +71,16 @@ jobs: if: ${{ always() && env.CLOUDINARY_API_KEY != '' && env.CLOUDINARY_API_SECRET != '' && github.event.inputs.cloudinary == 'true'}} run: | chmod +x .github/scripts/upload_cloudinary.sh - ./.github/scripts/upload_cloudinary.sh + ./.github/scripts/upload_cloudinary.sh + + - name: Upload release to bitbucket + env: + VERSION_NUMBER: ${{ steps.tag_latest.outputs.value }} + BITBUCKET_TOKEN: ${{ secrets.BITBUCKET_TOKEN }} + if: ${{ always() && env.BITBUCKET_TOKEN != '' && github.event.inputs.bitbucket == 'true'}} + run: | + chmod +x .github/scripts/upload_bitbucket.sh + ./.github/scripts/upload_bitbucket.sh - name: Sync Push to Gitee