Skip to content

Commit 1dcfe66

Browse files
committed
Modify the build script
When NotStoreConfigHere.txt file exists, the configs not stored in the current folder
1 parent d6dd110 commit 1dcfe66

File tree

6 files changed

+35
-7
lines changed

6 files changed

+35
-7
lines changed

.github/workflows/build-linux.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
cd v2rayN
3434
dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r linux-x64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -o $OutputPath64
3535
dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r linux-arm64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -o $OutputPathArm64
36+
dotnet publish ./AmazTool/AmazTool.csproj -c Release -r linux-x64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -p:PublishTrimmed=true -o $OutputPath64
37+
dotnet publish ./AmazTool/AmazTool.csproj -c Release -r linux-arm64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -p:PublishTrimmed=true -o $OutputPathArm64
3638
3739
- name: Upload build artifacts
3840
uses: actions/upload-artifact@v4

.github/workflows/build-osx.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
cd v2rayN
3434
dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r osx-x64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -o $OutputPath64
3535
dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r osx-arm64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -o $OutputPathArm64
36+
dotnet publish ./AmazTool/AmazTool.csproj -c Release -r osx-x64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -p:PublishTrimmed=true -o $OutputPath64
37+
dotnet publish ./AmazTool/AmazTool.csproj -c Release -r osx-arm64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -p:PublishTrimmed=true -o $OutputPathArm64
3638
3739
- name: Upload build artifacts
3840
uses: actions/upload-artifact@v4
@@ -56,4 +58,20 @@ jobs:
5658
with:
5759
file: ${{ github.workspace }}/v2rayN*.dmg
5860
tag: ${{ github.event.inputs.release_tag }}
61+
file_glob: true
62+
63+
# release zip archive
64+
- name: Package release zip archive
65+
if: github.event.inputs.release_tag != ''
66+
run: |
67+
chmod 755 package-release-zip.sh
68+
./package-release-zip.sh $OutputArch $OutputPath64
69+
./package-release-zip.sh $OutputArchArm $OutputPathArm64
70+
71+
- name: Upload zip archive to release
72+
uses: svenstaro/upload-release-action@v2
73+
if: github.event.inputs.release_tag != ''
74+
with:
75+
file: ${{ github.workspace }}/v2rayN*.zip
76+
tag: ${{ github.event.inputs.release_tag }}
5977
file_glob: true

.github/workflows/build-windows.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ jobs:
3535
dotnet publish ./v2rayN/v2rayN.csproj -c Release -r win-x64 --self-contained false -p:PublishReadyToRun=false -p:PublishSingleFile=true -p:EnableWindowsTargeting=true -o $OutputPath64
3636
dotnet publish ./v2rayN/v2rayN.csproj -c Release -r win-arm64 --self-contained false -p:PublishReadyToRun=false -p:PublishSingleFile=true -p:EnableWindowsTargeting=true -o $OutputPathArm64
3737
dotnet publish ./v2rayN/v2rayN.csproj -c Release -r win-x64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -p:EnableWindowsTargeting=true -o $OutputPath64Sc
38+
dotnet publish ./AmazTool/AmazTool.csproj -c Release -r win-x64 --self-contained false -p:PublishReadyToRun=false -p:PublishSingleFile=true -p:EnableWindowsTargeting=true -o $OutputPath64
39+
dotnet publish ./AmazTool/AmazTool.csproj -c Release -r win-arm64 --self-contained false -p:PublishReadyToRun=false -p:PublishSingleFile=true -p:EnableWindowsTargeting=true -o $OutputPathArm64
40+
dotnet publish ./AmazTool/AmazTool.csproj -c Release -r win-x64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -p:PublishTrimmed=true -p:EnableWindowsTargeting=true -o $OutputPath64Sc
41+
3842
3943
- name: Upload build artifacts
4044
uses: actions/upload-artifact@v4

package-debian.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ PackagePath="v2rayN-Package-${Arch}"
88
mkdir -p "${PackagePath}/DEBIAN"
99
mkdir -p "${PackagePath}/opt"
1010
cp -rf $OutputPath "${PackagePath}/opt/v2rayN"
11+
echo "When this file exists, app will not store configs under this folder" > "${PackagePath}/opt/v2rayN/NotStoreConfigHere.txt"
1112

1213
if [ $Arch = "linux-64" ]; then
1314
Arch2="amd64"
@@ -44,6 +45,7 @@ EOF
4445

4546
sudo chmod 0755 "${PackagePath}/DEBIAN/postinst"
4647
sudo chmod 0755 "${PackagePath}/opt/v2rayN/v2rayN"
48+
sudo chmod 0755 "${PackagePath}/opt/v2rayN/AmazTool"
4749

4850
# desktop && PATH
4951

package-osx.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@ Arch="$1"
44
OutputPath="$2"
55
Version="$3"
66

7-
FileName="v2rayN-${Arch}.zip"
8-
wget -nv -O $FileName "https://github.com/2dust/v2rayN-core-bin/raw/refs/heads/master/$FileName"
9-
7z x $FileName
10-
cp -rf v2rayN-${Arch}/* $OutputPath
11-
127
PackagePath="v2rayN-Package-${Arch}"
138
mkdir -p "$PackagePath/v2rayN.app/Contents/Resources"
149
cp -rf "$OutputPath" "$PackagePath/v2rayN.app/Contents/MacOS"
10+
echo "When this file exists, app will not store configs under this folder" > "$PackagePath/v2rayN.app/Contents/MacOS/NotStoreConfigHere.txt"
1511
chmod +x "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN"
1612

1713
mkdir -p "$PackagePath/icons.iconset"
@@ -43,7 +39,7 @@ cat >"$PackagePath/v2rayN.app/Contents/Info.plist" <<-EOF
4339
<key>CFBundleIconName</key>
4440
<string>AppIcon</string>
4541
<key>CFBundleIdentifier</key>
46-
<string>v2rayN.desktop</string>
42+
<string>2dust.v2rayN</string>
4743
<key>CFBundleName</key>
4844
<string>v2rayN</string>
4945
<key>CFBundlePackageType</key>

v2rayN/ServiceLib/Common/Utils.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ public static int GetFreePort(int defaultPort = 9090)
517517

518518
public static bool UpgradeAppExists(out string fileName)
519519
{
520-
fileName = Path.Combine(Utils.StartupPath(), GetExeName("AmazTool"));
520+
fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, GetExeName("AmazTool"));
521521
return File.Exists(fileName);
522522
}
523523

@@ -675,6 +675,12 @@ public static bool HasWritePermission()
675675
{
676676
try
677677
{
678+
//When this file exists, it is equivalent to having no permission to read and write
679+
if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "NotStoreConfigHere.txt")))
680+
{
681+
return false;
682+
}
683+
678684
var tempPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "guiTemps");
679685
if (!Directory.Exists(tempPath))
680686
{

0 commit comments

Comments
 (0)