Skip to content

Commit

Permalink
fix fix fix
Browse files Browse the repository at this point in the history
  • Loading branch information
awakecoding committed Nov 22, 2023
1 parent d0d36e6 commit 3115148
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 12 deletions.
33 changes: 30 additions & 3 deletions .github/workflows/nuget-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
dry-run: ${{ steps.info.outputs.dry-run }}

steps:
- name: Get dry run
id: get-dry-run
- name: Package information
id: package-info
shell: pwsh
run: |
$IsMasterBranch = ('${{ github.ref_name }}' -eq 'master')
Expand Down Expand Up @@ -178,7 +178,7 @@ jobs:
path: package/*.nupkg

publish:
name: Publish NuGet package
name: Publish packages
runs-on: ubuntu-22.04
needs: [preflight, build-native, build-managed]
environment: ${{ needs.preflight.outputs.package-env }}
Expand Down Expand Up @@ -209,3 +209,30 @@ jobs:
} else {
& 'dotnet' $PushArgs
}
- name: Create GitHub release
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: package
run: |
$PackageVersion = '${{ needs.preflight.outputs.package-version }}'
$DryRun = [System.Boolean]::Parse('${{ needs.preflight.outputs.dry-run }}')
$HashPath = 'checksums'
$Files = Get-Item * | % { Get-FileHash -Algorithm SHA256 $_.FullName }
$Files | % { "$($_.Hash) $(Split-Path $_.Path -Leaf)" } | Out-File -FilePath $HashPath -Append -Encoding ASCII
echo "::group::checksums"
Get-Content $HashPath
echo "::endgroup::"
$ReleaseTag = "v$Version"
$ReleaseTitle = "MsRdpEx v${Version}"
$Repository = $Env:GITHUB_REPOSITORY
if ($DryRun) {
Write-Host "Dry Run: skipping GitHub release!"
} else {
& gh release create $ReleaseTag --repo $Repository --title $ReleaseTitle ./*
}
20 changes: 11 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ include(CMakePackageConfigHelpers)
include(WindowsRC)

file(STRINGS "${CMAKE_SOURCE_DIR}/dotnet/Devolutions.MsRdpEx/Devolutions.MsRdpEx.csproj" CSPROJ_LINES)
foreach(CSPROJ_LINE ${CSPROJ_LINES})
if(CSPROJ_LINE MATCHES "<Version>.*</Version>")
string(REGEX REPLACE "<Version>(.*)</Version>" "\\1" VERSION_STRING ${CSPROJ_LINE})
string(STRIP ${VERSION_STRING} VERSION_STRING)
foreach(CSPROJ_LINE IN LISTS CSPROJ_LINES)
if(CSPROJ_LINE MATCHES "<Version>([0-9]+.[0-9]+.[0-9]+.[0-9]+)</Version>")
set(VERSION_STRING "${CMAKE_MATCH_1}")
break()
endif()
endforeach()

string(REGEX REPLACE "([0-9]+).[0-9]+.[0-9]+.[0-9]+" "\\1" MSRDPEX_VERSION_MAJOR ${VERSION_STRING})
string(REGEX REPLACE "[0-9]+.([0-9]+).[0-9]+.[0-9]+" "\\1" MSRDPEX_VERSION_MINOR ${VERSION_STRING})
string(REGEX REPLACE "[0-9]+.[0-9]+.([0-9]+).[0-9]+" "\\1" MSRDPEX_VERSION_PATCH ${VERSION_STRING})
string(REGEX REPLACE "[0-9]+.[0-9]+.[0-9]+.([0-9]+)" "\\1" MSRDPEX_VERSION_BUILD ${VERSION_STRING})
string(REGEX MATCH "([0-9]+).[0-9]+.[0-9]+.[0-9]+" _ ${VERSION_STRING})
set(MSRDPEX_VERSION_MAJOR ${CMAKE_MATCH_1})
string(REGEX MATCH "[0-9]+.([0-9]+).[0-9]+.[0-9]+" _ ${VERSION_STRING})
set(MSRDPEX_VERSION_MINOR ${CMAKE_MATCH_1})
string(REGEX MATCH "[0-9]+.[0-9]+.([0-9]+).[0-9]+" _ ${VERSION_STRING})
set(MSRDPEX_VERSION_PATCH ${CMAKE_MATCH_1})
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+.([0-9]+)" _ ${VERSION_STRING})
set(MSRDPEX_VERSION_BUILD ${CMAKE_MATCH_1})
set(MSRDPEX_VERSION "${MSRDPEX_VERSION_MAJOR}.${MSRDPEX_VERSION_MINOR}.${MSRDPEX_VERSION_PATCH}.${MSRDPEX_VERSION_BUILD}")

message(STATUS "VERSION: ${MSRDPEX_VERSION}")
Expand Down

0 comments on commit 3115148

Please sign in to comment.