Skip to content

Centreon Monitoring Agent Windows packaging #3

Centreon Monitoring Agent Windows packaging

Centreon Monitoring Agent Windows packaging #3

name: Centreon Monitoring Agent Windows packaging
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
jobs:
build-vcpkg-and-export:
runs-on: windows-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.COLLECT_S3_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.COLLECT_S3_SECRET_KEY }}
steps:
- name: Checkout sources
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: install msvc command prompt
uses: ilammy/[email protected]
- name: install vcpkg
run: |
git clone --depth 1 https://github.com/microsoft/vcpkg
cd vcpkg
bootstrap-vcpkg.bat
- name: compile packages
run: |
[System.Environment]::SetEnvironmentVariable("VCPKG_ROOT",$pwd.ToString()+"\vcpkg")
[System.Environment]::SetEnvironmentVariable("PATH",$pwd.ToString()+"\vcpkg:" + $env:PATH)
cmake.exe --preset=release
- name: 7zip packages and save to s3
run: |
$files_to_hash= "vcpkg.json", "custom-triplets\x64-windows.cmake", "CMakeLists.txt", "CMakeListsWindows.txt"
$files_content= Get-Content -Path $files_to_hash -Raw
$stringAsStream = [System.IO.MemoryStream]::new()
$writer = [System.IO.StreamWriter]::new($stringAsStream)
$writer.write($files_content -join " ")
$writer.Flush()
$stringAsStream.Position = 0
$vcpkg_hash=Get-FileHash -InputStream $stringAsStream -Algorithm SHA256 | Select-Object Hash
$file_name = "centreon-agent-prebuild-" + $vcpkg_hash.Hash
$file_name_extension = "${file_name}.7z"
Write-Host "store vcpkg package to $file_name"
7z a $file_name_extension vcpkg
Write-Host "aws s3 cp $file_name_extension s3://centreon-collect-robot-report/$file_name_extension"
[System.Environment]::SetEnvironmentVariable("AWS_EC2_METADATA_DISABLED","true")
aws s3 cp $file_name_extension s3://centreon-collect-robot-report/$file_name_extension