diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index e8a898ba..d0383ebe 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -7,9 +7,14 @@ on: required: false type: string push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] + branches: + - master + +env: + OutputArch: "linux-64" + OutputArchArm: "linux-arm64" + OutputPath64: "${{ github.workspace }}/v2rayN/Release/linux-64" + OutputPathArm64: "${{ github.workspace }}/v2rayN/Release/linux-arm64" jobs: build: @@ -26,9 +31,6 @@ jobs: - name: Build run: | cd v2rayN - OutputPath='./bin/v2rayN' - OutputPath64="${OutputPath}/linux-x64" - OutputPathArm64="${OutputPath}/linux-arm64" dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r linux-x64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -o $OutputPath64 dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r linux-arm64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -o $OutputPathArm64 @@ -37,29 +39,36 @@ jobs: with: name: v2rayN-linux path: | - ./v2rayN/bin/v2rayN + ${{ github.workspace }}/v2rayN/Release/linux* + # release debian package - name: Package debian if: github.event.inputs.release_tag != '' run: | - cd v2rayN chmod 755 package-debian.sh - ./package-debian.sh ${{ github.event.inputs.release_tag }} x64 - ./package-debian.sh ${{ github.event.inputs.release_tag }} arm64 + ./package-debian.sh $OutputArch $OutputPath64 ${{ github.event.inputs.release_tag }} + ./package-debian.sh $OutputArchArm $OutputPathArm64 ${{ github.event.inputs.release_tag }} - - name: Upload Package artifacts - uses: actions/upload-artifact@v4 - if: github.event.inputs.release_tag != '' - with: - name: v2rayN-linux-Package - path: | - ${{ github.workspace }}/v2rayN/v2rayN*.deb - - - name: Upload to release + - name: Upload deb to release uses: svenstaro/upload-release-action@v2 if: github.event.inputs.release_tag != '' with: - file: ${{ github.workspace }}/v2rayN/v2rayN*.deb + file: ${{ github.workspace }}/v2rayN*.deb tag: ${{ github.event.inputs.release_tag }} file_glob: true - prerelease: true \ No newline at end of file + + # release zip archive + - name: Package release zip archive + if: github.event.inputs.release_tag != '' + run: | + chmod 755 package-release-zip.sh + ./package-release-zip.sh $OutputArch $OutputPath64 + ./package-release-zip.sh $OutputArchArm $OutputPathArm64 + + - name: Upload zip archive to release + uses: svenstaro/upload-release-action@v2 + if: github.event.inputs.release_tag != '' + with: + file: ${{ github.workspace }}/v2rayN*.zip + tag: ${{ github.event.inputs.release_tag }} + file_glob: true \ No newline at end of file diff --git a/.github/workflows/build-osx.yml b/.github/workflows/build-osx.yml index 803920d5..35f58bae 100644 --- a/.github/workflows/build-osx.yml +++ b/.github/workflows/build-osx.yml @@ -1,10 +1,20 @@ name: release macOS on: + workflow_dispatch: + inputs: + release_tag: + required: false + type: string push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] + branches: + - master + +env: + OutputArch: "macos-64" + OutputArchArm: "macos-arm64" + OutputPath64: "${{ github.workspace }}/v2rayN/Release/macos-64" + OutputPathArm64: "${{ github.workspace }}/v2rayN/Release/macos-arm64" jobs: build: @@ -21,17 +31,28 @@ jobs: - name: Build run: | cd v2rayN - OutputPath='./bin/v2rayN' - OutputPath64="${OutputPath}/osx-x64" - OutputPathArm64="${OutputPath}/osx-arm64" dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r osx-x64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -o $OutputPath64 dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r osx-arm64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -o $OutputPathArm64 - name: Upload build artifacts uses: actions/upload-artifact@v4 with: - name: v2rayN-osx + name: v2rayN-macos path: | - ./v2rayN/bin/v2rayN - - \ No newline at end of file + ${{ github.workspace }}/v2rayN/Release/macos* + + # release zip archive + - name: Package release zip archive + if: github.event.inputs.release_tag != '' + run: | + chmod 755 package-release-zip.sh + ./package-release-zip.sh $OutputArch $OutputPath64 + ./package-release-zip.sh $OutputArchArm $OutputPathArm64 + + - name: Upload zip archive to release + uses: svenstaro/upload-release-action@v2 + if: github.event.inputs.release_tag != '' + with: + file: ${{ github.workspace }}/v2rayN*.zip + tag: ${{ github.event.inputs.release_tag }} + file_glob: true \ No newline at end of file diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 778c0729..0baa8939 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -1,10 +1,21 @@ name: release Windows on: + workflow_dispatch: + inputs: + release_tag: + required: false + type: string push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] + branches: + - master + +env: + OutputArch: "windows-64" + OutputArchArm: "windows-arm64" + OutputPath64: "${{ github.workspace }}/v2rayN/Release/windows-64" + OutputPathArm64: "${{ github.workspace }}/v2rayN/Release/windows-arm64" + OutputPath64Sc: "${{ github.workspace }}/v2rayN/Release/windows-64-SelfContained" jobs: build: @@ -21,19 +32,32 @@ jobs: - name: Build run: | cd v2rayN - OutputPath='./bin/v2rayN' - OutputPath64="${OutputPath}/win-x64" - OutputPathArm64="${OutputPath}/win-arm64" dotnet publish ./v2rayN/v2rayN.csproj -c Release -r win-x64 --self-contained false -p:PublishReadyToRun=false -p:PublishSingleFile=true -p:EnableWindowsTargeting=true -o $OutputPath64 dotnet publish ./v2rayN/v2rayN.csproj -c Release -r win-arm64 --self-contained false -p:PublishReadyToRun=false -p:PublishSingleFile=true -p:EnableWindowsTargeting=true -o $OutputPathArm64 - + dotnet publish ./v2rayN/v2rayN.csproj -c Release -r win-x64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -p:EnableWindowsTargeting=true -o $OutputPath64Sc + - name: Upload build artifacts uses: actions/upload-artifact@v4 with: name: v2rayN-windows path: | - ./v2rayN/bin/v2rayN - - - - + ${{ github.workspace }}/v2rayN/Release/windows* + + # release zip archive + - name: Package release zip archive + if: github.event.inputs.release_tag != '' + run: | + chmod 755 package-release-zip.sh + ./package-release-zip.sh $OutputArch $OutputPath64 + ./package-release-zip.sh "windows-64-With-Core" $OutputPath64 + ./package-release-zip.sh $OutputArchArm $OutputPathArm64 + ./package-release-zip.sh "windows-64-SelfContained" $OutputPath64Sc + ./package-release-zip.sh "windows-64-SelfContained-With-Core" $OutputPath64Sc + + - name: Upload zip archive to release + uses: svenstaro/upload-release-action@v2 + if: github.event.inputs.release_tag != '' + with: + file: ${{ github.workspace }}/v2rayN*.zip + tag: ${{ github.event.inputs.release_tag }} + file_glob: true \ No newline at end of file diff --git a/v2rayN/package-debian.sh b/package-debian.sh similarity index 56% rename from v2rayN/package-debian.sh rename to package-debian.sh index c1ad3a12..0e7eab8e 100644 --- a/v2rayN/package-debian.sh +++ b/package-debian.sh @@ -1,16 +1,15 @@ #!/bin/bash -version="$1" -arch="$2" +Arch="$1" +OutputPath="$2" +Version="$3" -OutputPath="v2rayN-linux-${arch}" -mkdir -p "${OutputPath}/DEBIAN" -mkdir -p "${OutputPath}/opt" -cp -r "./bin/v2rayN/linux-${arch}" "${OutputPath}/opt" -mv "${OutputPath}/opt/linux-${arch}" "${OutputPath}/opt/v2rayN" +PackagePath="v2rayN-Package-${Arch}" +mkdir -p "${PackagePath}/DEBIAN" +mkdir -p "${PackagePath}/opt" +cp -rf $OutputPath "${PackagePath}/opt/v2rayN" - -if [ $arch = "x64" ]; then +if [ $Arch = "linux-64" ]; then Arch2="amd64" else Arch2="arm64" @@ -18,15 +17,15 @@ fi echo $Arch2 # basic -cat >"${OutputPath}/DEBIAN/control" <<-EOF +cat >"${PackagePath}/DEBIAN/control" <<-EOF Package: v2rayN -Version: $version +Version: $Version Architecture: $Arch2 Maintainer: https://github.com/2dust/v2rayN Description: A GUI client for Windows and Linux, support Xray core and sing-box-core and others EOF -cat >"${OutputPath}/DEBIAN/postinst" <<-EOF +cat >"${PackagePath}/DEBIAN/postinst" <<-EOF if [ ! -s /usr/share/applications/v2rayN.desktop ]; then cat >/usr/share/applications/v2rayN.desktop<<-END [Desktop Entry] @@ -43,9 +42,10 @@ fi update-desktop-database EOF -sudo chmod 0755 "${OutputPath}/DEBIAN/postinst" -sudo chmod 0755 "${OutputPath}/opt/v2rayN/v2rayN" +sudo chmod 0755 "${PackagePath}/DEBIAN/postinst" +sudo chmod 0755 "${PackagePath}/opt/v2rayN/v2rayN" # desktop && PATH -sudo dpkg-deb -Zxz --build $OutputPath \ No newline at end of file +sudo dpkg-deb -Zxz --build $PackagePath +sudo mv "${PackagePath}.deb" "v2rayN-${Arch}.deb" \ No newline at end of file diff --git a/package-release-zip.sh b/package-release-zip.sh new file mode 100644 index 00000000..60804e69 --- /dev/null +++ b/package-release-zip.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +Arch="$1" +OutputPath="$2" + +OutputArch="v2rayN-${Arch}" +FileName="v2rayN-${Arch}.zip" + +wget -nv -O $FileName "https://github.com/2dust/v2rayN-core-bin/raw/refs/heads/master/$FileName" + +ZipPath64="./$OutputArch" +mkdir $ZipPath64 + +cp -rf $OutputPath "$ZipPath64/$OutputArch" +7z a -tZip $FileName "$ZipPath64/$OutputArch" -mx1 \ No newline at end of file