3 changed files with 36 additions and 60 deletions
@ -1,20 +1,32 @@ |
|||
# build project |
|||
yarn build |
|||
# rename dist to current time, like 20221215121300 |
|||
$now = Get-Date -Format "yyyyMMddHHmmss" |
|||
Rename-Item -Path ./dist -NewName $now |
|||
# compress dist to app.zip |
|||
Compress-Archive -Path ./$now -DestinationPath ./app.zip -Force |
|||
# upload app.zip to server |
|||
scp app.zip root@192.168.8.12:/frontend/ |
|||
# unzip app.zip |
|||
ssh root:zwsd@192.168.8.12 "cd /frontend && unzip app.zip" |
|||
# remove old link |
|||
ssh root:zwsd@192.168.8.12 "cd /frontend && rm -f dist" |
|||
# create link |
|||
ssh root:zwsd@192.168.8.12 "cd /frontend && ln -s /frontend/$now /frontend/dist" |
|||
# remove app.zip |
|||
ssh root:zwsd@192.168.8.12 "cd /frontend && rm -f app.zip" |
|||
Remove-Item -Path ./app.zip |
|||
# remove folder |
|||
Remove-Item -Path ./$now -Recurse |
|||
Param( |
|||
[String]$Exec="Deplay" |
|||
) |
|||
|
|||
if ( $Exec -eq "DevDisable" ) { |
|||
ssh root:zwsd@192.168.8.12 "rm /var/zapp_flag/chrome_in_test_mode"; |
|||
ssh root:zwsd@192.168.8.12 "reboot" |
|||
} elseif ( $Exec -eq "DevEnable" ) { |
|||
ssh root:zwsd@192.168.8.12 "touch /var/zapp_flag/chrome_in_test_mode"; |
|||
ssh root:zwsd@192.168.8.12 "reboot" |
|||
} elseif ( $Exec -eq "Deplay" ) { |
|||
# build project |
|||
yarn build |
|||
# rename dist to current time, like 20221215121300 |
|||
$now = Get-Date -Format "yyyyMMddHHmmss" |
|||
Rename-Item -Path ./dist -NewName $now |
|||
# compress dist to app.zip |
|||
Compress-Archive -Path ./$now -DestinationPath ./app.zip -Force |
|||
# upload app.zip to server |
|||
scp app.zip root@192.168.8.12:/frontend/ |
|||
# unzip app.zip |
|||
ssh root:zwsd@192.168.8.12 "cd /frontend && unzip app.zip" |
|||
# remove old link |
|||
ssh root:zwsd@192.168.8.12 "cd /frontend && rm -f dist" |
|||
# create link |
|||
ssh root:zwsd@192.168.8.12 "cd /frontend && ln -s /frontend/$now /frontend/dist" |
|||
# remove app.zip |
|||
ssh root:zwsd@192.168.8.12 "cd /frontend && rm -f app.zip" |
|||
Remove-Item -Path ./app.zip |
|||
# remove folder |
|||
Remove-Item -Path ./$now -Recurse |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue