Skip to content

Commit

Permalink
Update build workflows (#7)
Browse files Browse the repository at this point in the history
* Update build workflow to publish to Nuget and Azure
Update project metadata
Update version

* Update feed URLs
  • Loading branch information
jechague authored Jul 23, 2022
1 parent e534ecf commit 2cf2052
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 19 deletions.
81 changes: 75 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Build

on:
on:
workflow_dispatch:
inputs:
skip-duplicates:
description: 'Whether to fail or skip duplicates when uploading to a package repository'
required: false
default: 'true'
push:
branches:
- 'master'
Expand All @@ -27,10 +33,15 @@ jobs:
with:
fetch-depth: 0

- name: Install .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'

- name: Restore
run: dotnet restore $Env:SolutionFile

- name: Prepare Nuspec and Build
- name: Prepare Nuspec
run: |
[xml]$build_props = Get-Content $Env:BuildProps
$PACKAGE_VERSION = $build_props.Project.PropertyGroup.AssemblyVersion
Expand All @@ -52,16 +63,74 @@ jobs:
$xml.package.metadata.repository.branch = $Env:GITHUB_REF
$xml.package.metadata.repository.commit = $Env:GITHUB_SHA
Write-Output "Packge version to be used: $NEW_PACKAGE_VERSION"
echo "NUGET_PACKAGE_VERSION=$NEW_PACKAGE_VERSION" >> $env:GITHUB_ENV
$xml.Save($Env:NuspecFile)
dotnet msbuild $Env:SolutionFile -p:Configuration=$Env:Configuration /t:Clean,Build
- name: Build
run: 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

- name: Sign
if: github.base_ref == ''
env:
TIMESTAMPER_URL: ${{ secrets.CODE_SIGN_CERTIFICATE_TIMESTAMPER_URL }}
PFX_BASE64: ${{ secrets.CODE_SIGN_CERTIFICATE_BASE64 }}
PFX_PASS: ${{ secrets.CODE_SIGN_CERTIFICATE_PASSWORD }}
run: |
$codesign_pfx = "code_sign_cert.pfx"
$bytes = [Convert]::FromBase64String($Env:PFX_BASE64)
[IO.File]::WriteAllBytes($codesign_pfx, $bytes)
Get-ChildItem ".\*.nupkg" -Recurse | ForEach-Object {
dotnet nuget sign $_.FullName --certificate-path $codesign_pfx --certificate-password $Env:PFX_PASS --timestamper $Env:TIMESTAMPER_URL
}
- name: Configure Azure Artifacts feed
if: github.base_ref == ''
env:
AzureArtifactsPrereleaseFeedURL: https://pkgs.dev.azure.com/genexuslabs/13fb82d9-57a8-49ef-95bb-0ec8324e470c/_packaging/dotnet-prereleases/nuget/v3/index.json
AzureArtifactsReleaseFeedURL: https://pkgs.dev.azure.com/genexuslabs/13fb82d9-57a8-49ef-95bb-0ec8324e470c/_packaging/dotnet-releases/nuget/v3/index.json
run: |
$IsPrerelease = "${{ github.ref }}".StartsWith("refs/heads/")
$AZURE_ARTIFACTS_URL = @("$Env:AzureArtifactsReleaseFeedURL", "$Env:AzureArtifactsPrereleaseFeedURL")[$IsPrerelease]
dotnet nuget add source $AZURE_ARTIFACTS_URL --name AzureArtifacts --username genexuslabs --password ${{ secrets.AZURE_ARTIFACTS_TOKEN }}
echo "AZURE_ARTIFACTS_URL=$AZURE_ARTIFACTS_URL" >> $env:GITHUB_ENV
- name: Publish
if: github.repository_owner == 'GeneXusLabs' && github.base_ref == ''
if: github.base_ref == ''
env:
GPRUrl: https://nuget.pkg.github.com/genexuslabs/index.json
run: dotnet nuget push build\packages\GXOData.Client.*.nupkg --source $Env:GPRUrl --api-key ${{ secrets.SECURE_TOKEN }}
GPRFeedURL: https://nuget.pkg.github.com/genexuslabs/index.json
NuGetFeedURL: https://api.nuget.org/v3/index.json
run: |
$IsPrerelease = "${{ github.ref }}".StartsWith("refs/heads/")
Get-ChildItem ".\*.nupkg" -Recurse | ForEach-Object {
$PushToGitHubArgs = @("nuget", "push", $_.FullName, "--source", $Env:GPRFeedURL, "--api-key", "${{ secrets.SECURE_TOKEN }}")
$PushToNugetArgs = @("nuget", "push", $_.FullName, "--source", $Env:NuGetFeedURL, "--api-key", "${{ secrets.NUGET_ORG_TOKEN }}")
$PushToAzureArgs = @("nuget", "push", $_.FullName, "--source", $Env:AZURE_ARTIFACTS_URL, "--api-key", "DUMMY-KEY")
if ([string]::IsNullOrEmpty("${{ github.event.inputs.skip-duplicates }}") ) {
$skipDuplicates = $true
} else {
$skipDuplicates = [System.Convert]::ToBoolean("${{ github.event.inputs.skip-duplicates }}")
}
if ($skipDuplicates) {
$PushToNugetArgs += "--skip-duplicate"
$PushToGitHubArgs += "--skip-duplicate"
$PushToAzureArgs += "--skip-duplicate"
}
dotnet $PushToAzureArgs
if (! $IsPrerelease) {
dotnet $PushToGitHubArgs
dotnet $PushToNugetArgs
}
}
6 changes: 3 additions & 3 deletions GXOData.Client.nuspec
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0"?>
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>GXOdata.Client</id>
<id>GeneXus.Odata.Client</id>
<authors>Vagif Abilov and GeneXus</authors>
<version></version>
<owners>Vagif Abilov</owners>
<owners>GeneXus</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.
The package GXOdata.Client contains libraries that can work with OData feeds that implement both V1-3 and V4 OData protocol.
Expand All @@ -15,7 +15,7 @@
</summary>
<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>
<copyright>Copyright 2012-2022 GeneXus</copyright>
<language>en-us</language>
<tags>odata data rest client portable pcl netfx net40 net45 netstandard netcore mono adnroid ios</tags>
<dependencies>
Expand Down
18 changes: 9 additions & 9 deletions Simple.OData.Client.nuspec
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?xml version="1.0"?>
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>Simple.OData.Client</id>
<authors>Vagif Abilov</authors>
<id>GeneXus.GXOdata.Client</id>
<authors>GeneXus</authors>
<version>0.0.0.0</version>
<owners>Vagif Abilov</owners>
<owners>GeneXus</owners>
<description>
Simple.OData.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 Simple.OData.Client contains libraries that can work with OData feeds that implement both V1-3 and V4 OData protocol.
GeneXus.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 GeneXus.GXOdata.Client contains libraries that can work with OData feeds that implement both V1-3 and V4 OData protocol.
Packages Simple.OData.V3.Client and Simple.OData.V4.Client have smaller footprints and target V1-3 and V4 respectively.
</description>
<summary>
Simple.OData.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 Simple.OData.Client contains libraries that can work with OData feeds that implement both V1-3 and V4 OData protocol.
GeneXus.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 GeneXus.GXOdata.Client contains libraries that can work with OData feeds that implement both V1-3 and V4 OData protocol.
Packages Simple.OData.V3.Client and Simple.OData.V4.Client have smaller footprints and target V1-3 and V4 respectively.
</summary>
<projectUrl>https://github.com/object/Simple.OData.Client</projectUrl>
<projectUrl>https://github.com/genexuslabs/Simple.OData.Client</projectUrl>
<licenseUrl>http://www.opensource.org/licenses/mit-license.php</licenseUrl>
<iconUrl>http://www.odata.org/wp-content/uploads/2014/05/ODataLogo-96.png</iconUrl>
<copyright>Copyright 2012-2018 Vagif Abilov</copyright>
<copyright>Copyright 2012-2022 GeneXus</copyright>
<language>en-us</language>
<tags>odata data rest client portable pcl netfx net40 net45 netstandard netcore mono adnroid ios</tags>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion src/GXOdata.Client.All/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<AssemblyVersion>5.2.3.5</AssemblyVersion>
<AssemblyVersion>5.2.3.7</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<InformationalVersion>$([System.DateTime]::UtcNow.ToString("yyyyMMddHHmmss")).$(GITHUB_SHA)</InformationalVersion>
<Company>GeneXus</Company>
Expand Down

0 comments on commit 2cf2052

Please sign in to comment.