UPD: Workflows

This commit is contained in:
Alexander Koblov 2023-04-15 00:26:13 +03:00
commit fdc5110da0
4 changed files with 124 additions and 18 deletions

65
.github/scripts/create_snapshot.bat vendored Normal file
View file

@ -0,0 +1,65 @@
rem Set Double Commander version
set DC_VER=1.1.0
rem The new package will be created from here
set BUILD_PACK_DIR=%TEMP%\doublecmd-release
rem The new package will be saved here
set PACK_DIR=%CD%\doublecmd-release
rem Prepare target dir
mkdir %PACK_DIR%
rem Get revision number
call src\platform\git2revisioninc.exe.cmd %CD%
echo %REVISION%> %PACK_DIR%\revision.txt
rem Change log
git log -n 10 --format="%%h %%al %%ai%%n%%s%%n" > %PACK_DIR%\changelog.txt
rem Get libraries
pushd install
curl -o windows.7z -L https://github.com/doublecmd/snapshots/raw/main/windows.7z
"%ProgramFiles%\7-Zip\7z.exe" x windows.7z
del /Q windows.7z
popd
rem Set processor architecture
set CPU_TARGET=i386
set OS_TARGET=win32
call :doublecmd
rem Set processor architecture
set CPU_TARGET=x86_64
set OS_TARGET=win64
call :doublecmd
GOTO:EOF
:doublecmd
rem Build all components of Double Commander
call build.bat darkwin
rem Copy libraries
copy install\windows\lib\%CPU_TARGET%\*.dll %CD%\
copy install\windows\lib\%CPU_TARGET%\winpty-agent.exe %CD%\
rem Prepare install dir
mkdir %BUILD_PACK_DIR%
rem Prepare install files
call install\windows\install.bat
rem Create *.7z archive
"%ProgramFiles%\7-Zip\7z.exe" a -mx9 %PACK_DIR%\doublecmd-%DC_VER%.r%REVISION%.%CPU_TARGET%-%OS_TARGET%.7z %DC_INSTALL_DIR%\*
rem Clean
del /Q *.dll
del /Q *.exe
call clean.bat
rm -rf %BUILD_PACK_DIR%
GOTO:EOF

View file

@ -4,7 +4,7 @@
DC_VER=1.1.0
# The new package will be saved here
PACK_DIR=/var/tmp/doublecmd-release
PACK_DIR=$PWD/doublecmd-release
# Temp dir for creating *.dmg package
BUILD_PACK_DIR=/var/tmp/doublecmd-$(date +%y.%m.%d)

View file

@ -1,11 +1,32 @@
#!/bin/bash
echo "$SSH_PRIVATE_KEY" > ssh_key && chmod 0600 ssh_key
sftp -o StrictHostKeyChecking=no -i ssh_key $REMOTE_USER@$REMOTE_HOST <<END
cd /home/project-web/doublecmd/htdocs/snapshots
lcd /var/tmp/doublecmd-release
rm *.dmg
put *.dmg
put *.php
quit
END
echo $OSTYPE
echo "$SSH_PRIVATE_KEY" > ssh_key
echo "cd /home/project-web/doublecmd/htdocs/snapshots" > upload_snapshot.txt
echo "lcd doublecmd-release" >> upload_snapshot.txt
if [[ "$OSTYPE" == "msys" ]]; then
icacls.exe ssh_key //inheritance:r
echo "rm *.7z" >> upload_snapshot.txt
echo "put *.7z" >> upload_snapshot.txt
echo "put *.txt" >> upload_snapshot.txt
else
chmod 0600 ssh_key
echo "rm *.dmg" >> upload_snapshot.txt
echo "put *.dmg" >> upload_snapshot.txt
echo "put *.php" >> upload_snapshot.txt
fi
echo "quit" >> upload_snapshot.txt
sftp -o StrictHostKeyChecking=no -i ssh_key -b upload_snapshot.txt $REMOTE_USER@$REMOTE_HOST
rm -f ssh_key upload_snapshot.txt