Skip to content

Commit

Permalink
Create msi installer on redis-windows base
Browse files Browse the repository at this point in the history
  • Loading branch information
nasrullonurullaev committed Oct 2, 2024
1 parent 853c62c commit c0dec3d
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 47 deletions.
57 changes: 10 additions & 47 deletions .github/workflows/ci-diy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,44 +37,6 @@ jobs:
- run: |
dotnet publish -c Release -r win-x64 --sc
- uses: msys2/setup-msys2@v2
with:
update: true
install: gcc make pkg-config libopenssl openssl-devel zip
- name: msys2 Build Redis
if: ${{ success() }}
run: |
workspace=$(pwd)
mkdir ${{ env.REDIS_DIST }}-msys2
sed -i 's/__GNU_VISIBLE/1/' /usr/include/dlfcn.h
tar -xzf redis-${{ env.RELEASE_VERSION }}.tar.gz
cd redis-${{ env.RELEASE_VERSION }}/src && ./mkreleasehdr.sh
sed -i 's/\"\;/\"/' asciilogo.h
echo '" Redis for Windows Project Home \n"' >> asciilogo.h
echo '" https://github.com/redis-windows/redis-windows \n\n";' >> asciilogo.h
cd ..
make BUILD_TLS=yes CFLAGS="-Wno-char-subscripts -O0"
find . -mindepth 1 -maxdepth 2 -type f -regex '.*\(\.exe\|\.conf\)' -exec cp -f "{}" "$workspace/${{ env.REDIS_DIST }}-msys2" \;
cd $workspace
cp README.md README.zh_CN.md start.bat /usr/bin/msys-2.0.dll /usr/bin/msys-crypto-3.dll /usr/bin/msys-ssl-3.dll ${{ env.REDIS_DIST }}-msys2
sed -i 's/pidfile \/var\/run/pidfile ./' ${{ env.REDIS_DIST }}-msys2/redis.conf
zip -q -r ${{ env.REDIS_DIST }}-msys2.zip ${{ env.REDIS_DIST }}-msys2
cp install_redis_service.bat uninstall_redis_service.bat publish/* ${{ env.REDIS_DIST }}-msys2/
mv ${{ env.REDIS_DIST }}-msys2 ${{ env.REDIS_DIST }}-msys2-with-Service
zip -q -r ${{ env.REDIS_DIST }}-msys2-with-Service.zip ${{ env.REDIS_DIST }}-msys2-with-Service
shell: msys2 {0}

- name: Verify msys2 version
if: ${{ success() }}
run: |
$REDIS_MSYS2_VERSION_INFO=(./${{ env.REDIS_DIST }}-msys2-with-Service/redis-server.exe --version )
echo $REDIS_MSYS2_VERSION_INFO
# If ( -not ( $REDIS_MSYS2_VERSION_INFO -match "${{ env.RELEASE_VERSION }}" ) ) {
# Write-Output "msys2 verification failed"
# exit 1
# }
- uses: cygwin/cygwin-install-action@master
with:
packages: make gcc-core pkg-config libssl-devel zip
Expand All @@ -98,7 +60,7 @@ jobs:
cp README.md README.zh_CN.md start.bat /bin/cygcrypto-3.dll /bin/cygwin1.dll /bin/cygssl-3.dll /bin/cygz.dll ${{ env.REDIS_DIST }}-cygwin ;
sed -i 's/pidfile \/var\/run/pidfile ./' ${{ env.REDIS_DIST }}-cygwin/redis.conf ;
zip -q -r ${{ env.REDIS_DIST }}-cygwin.zip ${{ env.REDIS_DIST }}-cygwin ;
cp install_redis_service.bat uninstall_redis_service.bat publish/* ${{ env.REDIS_DIST }}-cygwin/ ;
cp install_redis_service.bat uninstall_redis_service.bat Redis.wxs publish/* ${{ env.REDIS_DIST }}-cygwin/ ;
mv ${{ env.REDIS_DIST }}-cygwin ${{ env.REDIS_DIST }}-cygwin-with-Service ;
zip -q -r ${{ env.REDIS_DIST }}-cygwin-with-Service.zip ${{ env.REDIS_DIST }}-cygwin-with-Service
shell: bash
Expand All @@ -113,16 +75,18 @@ jobs:
# exit 1
# }
- name: Create installer
run: |
dotnet tool install --global wix
ls -R ./${{ env.REDIS_DIST }}-cygwin-with-Service
cd ${{ env.REDIS_DIST }}-cygwin-with-Service
wix build Redis.wxs -arch x64 -o ../${{ env.REDIS_DIST }}.msi
- name: Calculate the hash value
if: ${{ success() }}
run: |
'Hashes' | Out-File -Append .\redis_latest_body.txt
'=========' | Out-File -Append .\redis_latest_body.txt
Get-FileHash .\${{ env.REDIS_DIST }}-msys2.zip | Format-List
Get-FileHash .\${{ env.REDIS_DIST }}-msys2.zip | Format-List | Out-File -Append .\redis_latest_body.txt
Get-FileHash .\${{ env.REDIS_DIST }}-msys2-with-Service.zip | Format-List
Get-FileHash .\${{ env.REDIS_DIST }}-msys2-with-Service.zip | Format-List | Out-File -Append .\redis_latest_body.txt
'=========' | Out-File -Append .\redis_latest_body.txt
Get-FileHash .\${{ env.REDIS_DIST }}-cygwin.zip | Format-List
Get-FileHash .\${{ env.REDIS_DIST }}-cygwin.zip | Format-List | Out-File -Append .\redis_latest_body.txt
Get-FileHash .\${{ env.REDIS_DIST }}-cygwin-with-Service.zip | Format-List
Expand All @@ -146,5 +110,4 @@ jobs:
files: |
${{ env.REDIS_DIST }}-cygwin.zip
${{ env.REDIS_DIST }}-cygwin-with-Service.zip
${{ env.REDIS_DIST }}-msys2.zip
${{ env.REDIS_DIST }}-msys2-with-Service.zip
${{ env.REDIS_DIST }}.msi
53 changes: 53 additions & 0 deletions Redis.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Package Name="Redis-Windows"
Manufacturer="Ascensio System SIA"
Version="7.4.0"
UpgradeCode="05410198-7212-4FC4-B7C8-AFEFC3DA0FBC"
Compressed="true"
InstallerVersion="200">
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />

<MediaTemplate EmbedCab="yes" />

<StandardDirectory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="!(bind.Property.ProductName)" />
</StandardDirectory>

<ComponentGroup Id="RedisServiceComponents" Directory="INSTALLFOLDER">
<Component Id="ServiceExecutable">
<File Source="RedisService.exe" />

<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Name="Redis"
DisplayName="Redis"
Description="Redis"
Start="auto"
ErrorControl="normal" />

<ServiceControl Id="StartService"
Start="install"
Stop="both"
Remove="uninstall"
Name="Redis"
Wait="true" />
</Component>
</ComponentGroup>
<ComponentGroup Id="RedisComponents" Directory="INSTALLFOLDER">
<Files Include="*.dll" />
<Files Include="*.conf" />
<File Source="redis-benchmark.exe" />
<File Source="redis-check-aof.exe" />
<File Source="redis-check-rdb.exe" />
<File Source="redis-cli.exe" />
<File Source="redis-sentinel.exe" />
<File Source="redis-server.exe" />
</ComponentGroup>

<Feature Id="Redis">
<ComponentGroupRef Id="RedisServiceComponents"/>
<ComponentGroupRef Id="RedisComponents"/>
</Feature>
</Package>
</Wix>

0 comments on commit c0dec3d

Please sign in to comment.