Skip to content

Commit

Permalink
Improve assembly versioning (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
jechague authored Jan 17, 2020
1 parent f0364c8 commit 236529a
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 25 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/PRBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ on: [pull_request]
jobs:
build:
env:
BuildProps: src\GXOdata.Client.All\Directory.Build.props
Configuration: Release
SolutionFile: GXOData.Client.sln
NuspecFile: GXOData.Client.nuspec
PackageFolder: build/packages/
SolutionFile: GXOData.Client.sln

runs-on: windows-latest

Expand All @@ -22,10 +23,28 @@ jobs:
- name: Build
run: dotnet msbuild $Env:SolutionFile -p:Configuration=$Env:Configuration

- name: Prepare Nuspec
- name: Prepare Nuspec and Build
run: |
(gc $Env:NuspecFile) -replace '#GIT_BRANCH#', $Env:GITHUB_REF | Out-File -encoding ASCII $Env:NuspecFile
(gc $Env:NuspecFile) -replace '#GIT_SHA#', $Env:GITHUB_SHA | Out-File -encoding ASCII $Env:NuspecFile
[xml]$build_props = Get-Content $Env:BuildProps
$PACKAGE_VERSION = $build_props.Project.PropertyGroup.AssemblyVersion
if (!$PACKAGE_VERSION) {
Write-Output "Unable to find package version in Nuspec file"
exit 1
}
$COMMITS_INTERVAL = (git describe --tags --abbrev=0) + '..HEAD'
$BUILD_NUMBER = git rev-list --first-parent --count $COMMITS_INTERVAL
$NEW_PACKAGE_VERSION = $PACKAGE_VERSION + '-rc' + $BUILD_NUMBER
[xml]$xml = Get-Content $Env:NuspecFile
$xml.package.metadata.version = $NEW_PACKAGE_VERSION
$xml.package.metadata.repository.branch = $Env:GITHUB_REF
$xml.package.metadata.repository.commit = $Env:GITHUB_SHA
$xml.Save($Env:NuspecFile)
dotnet msbuild $Env:SolutionFile -p:Configuration=$Env:Configuration /t:Clean,Build
- name: Package
run: dotnet pack $Env:SolutionFile --output $Env:PackageFolder /p:NuspecFile=..\..\$Env:NuspecFile
33 changes: 24 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build prerelease version of GXOdata.Client.All
name: Build

on:
push:
Expand All @@ -10,11 +10,12 @@ on:
jobs:
build:
env:
BuildProps: src\GXOdata.Client.All\Directory.Build.props
Configuration: Release
NuGetRepository: http://nexus.genexus.com/repository/nuget-prereleases/
SolutionFile: GXOData.Client.sln
NuspecFile: GXOData.Client.nuspec
PackageFolder: build/packages/
SolutionFile: GXOData.Client.sln

runs-on: [self-hosted, windows]

Expand All @@ -32,14 +33,28 @@ jobs:
- name: Restore
run: dotnet restore $Env:SolutionFile

- name: Build
run: dotnet msbuild $Env:SolutionFile -p:Configuration=$Env:Configuration

- name: Prepare Nuspec
- name: Prepare Nuspec and Build
run: |
(gc $Env:NuspecFile) -replace '#GIT_BRANCH#', $Env:GITHUB_REF | Out-File -encoding ASCII $Env:NuspecFile
(gc $Env:NuspecFile) -replace '#GIT_SHA#', $Env:GITHUB_SHA | Out-File -encoding ASCII $Env:NuspecFile
(gc $Env:NuspecFile) -replace '</version>', '-rc</version>' | Out-File -encoding ASCII $Env:NuspecFile
[xml]$build_props = Get-Content $Env:BuildProps
$PACKAGE_VERSION = $build_props.Project.PropertyGroup.AssemblyVersion
if (!$PACKAGE_VERSION) {
Write-Output "Unable to find package version in Nuspec file"
exit 1
}
$COMMITS_INTERVAL = (git describe --tags --abbrev=0) + '..HEAD'
$BUILD_NUMBER = git rev-list --first-parent --count $COMMITS_INTERVAL
$NEW_PACKAGE_VERSION = $PACKAGE_VERSION + '-rc' + $BUILD_NUMBER
[xml]$xml = Get-Content $Env:NuspecFile
$xml.package.metadata.version = $NEW_PACKAGE_VERSION
$xml.package.metadata.repository.branch = $Env:GITHUB_REF
$xml.package.metadata.repository.commit = $Env:GITHUB_SHA
$xml.Save($Env:NuspecFile)
dotnet msbuild $Env:SolutionFile -p:Configuration=$Env:Configuration /t:Clean,Build
- name: Package
run: dotnet pack $Env:SolutionFile --output $Env:PackageFolder /p:NuspecFile=..\..\$Env:NuspecFile
Expand Down
30 changes: 23 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ on:
jobs:
build:
env:
BuildProps: src\GXOdata.Client.All\Directory.Build.props
Configuration: Release
NuGetRepository: http://nexus.genexus.com/repository/nuget-hosted/
SolutionFile: GXOData.Client.sln
NuspecFile: GXOData.Client.nuspec
PackageFolder: build/packages/
SolutionFile: GXOData.Client.sln

runs-on: [self-hosted, windows]

Expand All @@ -29,13 +30,28 @@ jobs:
- name: Restore
run: dotnet restore $Env:SolutionFile

- name: Build
run: dotnet msbuild $Env:SolutionFile -p:Configuration=$Env:Configuration

- name: Prepare Nuspec
- name: Prepare Nuspec and Build
run: |
(gc $Env:NuspecFile) -replace '#GIT_BRANCH#', $Env:GITHUB_REF | Out-File -encoding ASCII $Env:NuspecFile
(gc $Env:NuspecFile) -replace '#GIT_SHA#', $Env:GITHUB_SHA | Out-File -encoding ASCII $Env:NuspecFile
[xml]$build_props = Get-Content $Env:BuildProps
$PACKAGE_VERSION = $build_props.Project.PropertyGroup.AssemblyVersion
if (!$PACKAGE_VERSION) {
Write-Output "Unable to find package version in Nuspec file"
exit 1
}
$COMMITS_INTERVAL = (git describe --tags --abbrev=0) + '..HEAD'
$BUILD_NUMBER = git rev-list --first-parent --count $COMMITS_INTERVAL
$NEW_PACKAGE_VERSION = $PACKAGE_VERSION + '-rc' + $BUILD_NUMBER
[xml]$xml = Get-Content $Env:NuspecFile
$xml.package.metadata.version = $NEW_PACKAGE_VERSION
$xml.package.metadata.repository.branch = $Env:GITHUB_REF
$xml.package.metadata.repository.commit = $Env:GITHUB_SHA
$xml.Save($Env:NuspecFile)
dotnet msbuild $Env:SolutionFile -p:Configuration=$Env:Configuration /t:Clean,Build
- name: Package
run: dotnet pack $Env:SolutionFile --output $Env:PackageFolder /p:NuspecFile=..\..\$Env:NuspecFile
Expand Down
4 changes: 2 additions & 2 deletions GXOData.Client.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>GXOdata.Client</id>
<authors>Vagif Abilov and GeneXus</authors>
<version>5.2.3</version>
<version></version>
<owners>Vagif Abilov</owners>
<description>
GXOdata.Client is a multiplatform OData client library supporting .NET 4.x, .NET Standard, .NET Core, iOS and Android. The adapter provides a great alternative to WCF Data Services client. It does not require generation of context or entity classes and fits RESTful nature of OData services.
Expand All @@ -13,7 +13,7 @@
GXOdata.Client is a multiplatform OData client library supporting .NET 4.x, .NET Standard, .NET Core, iOS and Android. The adapter provides a great alternative to WCF Data Services client. It does not require generation of context or entity classes and fits RESTful nature of OData services.
The package GXOdata.Client contains libraries that can work with OData feeds that implement both V1-3 and V4 OData protocol.
</summary>
<repository type="git" url="https://github.com/genexuslabs/Simple.OData.Client.git" branch="#GIT_BRANCH#" commit="#GIT_SHA#" />
<repository type="git" url="https://github.com/genexuslabs/Simple.OData.Client.git" branch="" commit="" />
<license type="expression">MIT</license>
<copyright>Copyright 2012-2018 Vagif Abilov</copyright>
<language>en-us</language>
Expand Down
14 changes: 14 additions & 0 deletions src/GXOdata.Client.All/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project>
<PropertyGroup>
<AssemblyVersion>5.2.3.1</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<InformationalVersion>$([System.DateTime]::UtcNow.ToString("yyyyMMddHHmmss")).$(GITHUB_SHA)</InformationalVersion>
<Company>GeneXus</Company>
<CopyrightYear>$([System.DateTime]::UtcNow.ToString("yyyy"))</CopyrightYear>
<Copyright>Copyright © 1988-$(CopyrightYear) GeneXus. All Rights Reserved</Copyright>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<Authors>GeneXus</Authors>
<RepositoryType>git</RepositoryType>
</PropertyGroup>
</Project>
8 changes: 5 additions & 3 deletions src/GXOdata.Client.All/GXOData.Client.All.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-->TargetFrameworks>net452;netstandard2.0</TargetFrameworks-->
<TargetFrameworks>netstandard2.0;net452</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RootNamespace>Simple.OData.Client</RootNamespace>
<OutputPath>$(SolutionDir)/build/$(Configuration)/$(AssemblyName)/$(TargetFramework)/</OutputPath>
<OutDir>$(OutputPath)</OutDir>
Expand Down Expand Up @@ -44,4 +42,8 @@
<Compile Include="..\Simple.OData.Client.V4.Adapter\**\*.cs" Exclude="**\AssemblyInfo.cs" Label="V4Adapter" />
</ItemGroup>

<ItemGroup>
<Compile Remove="Properties\CommonAssemblyVersion.cs" />
</ItemGroup>

</Project>

0 comments on commit 236529a

Please sign in to comment.