13
13
14
14
#>
15
15
16
- # Build windows package
17
- flutter clean
18
- flutter build windows
16
+ # # Build windows package
17
+ # flutter clean
18
+ # flutter build windows
19
19
20
20
$root_dir = " $ ( pwd) "
21
21
$work_dir = " $root_dir \publish"
22
+ $package_dir = " $work_dir \starcoin_node_gui"
22
23
$starcoin_node_url = " https://github.com/starcoinorg/starcoin/releases/download/v2.0.3-alpha/starcoin-windows-latest.zip"
23
24
24
25
if (Test-Path $work_dir - PathType Container) {
@@ -27,10 +28,40 @@ if (Test-Path $work_dir -PathType Container) {
27
28
28
29
New-Item - Path $work_dir - ItemType Directory
29
30
30
- # Download the starcoin latest version
31
- Invoke-WebRequest - Uri $starcoin_node_url - OutFile " $work_dir \starcoin-windows-latest.zip"
31
+ # # Download the starcoin latest version
32
+ $starcoin_zip = " $work_dir \starcoin-windows-latest.zip"
33
+ Invoke-WebRequest - Uri $starcoin_node_url - OutFile $starcoin_zip
34
+
35
+ $retryCount = 0
36
+ $maxRetries = 4
37
+
38
+ while ($retryCount -lt $maxRetries -and -not (Test-Path - Path $starcoin_zip )) {
39
+ $retryCount ++
40
+
41
+ Write-Host " File download failed, try to download again, retry times: $retryCount ..."
42
+ Invoke-WebRequest - Uri $starcoin_node_url - OutFile $starcoin_zip
43
+
44
+ Start-Sleep - Seconds 5
45
+ }
46
+
47
+ # Check file is exist
48
+ if (! (Test-Path - Path $starcoin_zip )) {
49
+ Write-Error " File download failed, the maximum number of retries has been reached: $maxRetries "
50
+ exit 1
51
+ }
52
+
32
53
Expand-Archive - Path " $work_dir \starcoin-windows-latest.zip" - DestinationPath " $work_dir \starcoin" - Force
33
54
Remove-Item - Path " $work_dir \starcoin-windows-latest.zip" - Force
34
55
35
- # Compress zip
36
- Compress-Archive - Path (" $root_dir \build\windows\runner\Release" , " $work_dir \starcoin" ) - DestinationPath " $work_dir \starcoin_node_gui_windows.zip"
56
+
57
+ # Copy files
58
+ New-Item - Path " $package_dir " - ItemType Directory
59
+ Copy-Item - Path " $root_dir \build\windows\runner\Release\*" - Destination " $package_dir " - Recurse - Force
60
+
61
+ New-Item - Path " $package_dir \starcoin" - ItemType Directory
62
+ Copy-Item - Path " $work_dir \starcoin\starcoin-artifacts\*" - Destination " $package_dir \starcoin"
63
+
64
+ # Compress zip
65
+ Compress-Archive - Path $package_dir - DestinationPath " ${package_dir} _windows.zip"
66
+
67
+ Write-Output " Done!! Output dir: ${package_dir} _windows.zip"
0 commit comments