Skip to content

Commit 5a82dd5

Browse files
Merge changes from #646 to resolve package publication issue.
(cherry picked from commit e8b2c0a)
1 parent c11ded9 commit 5a82dd5

File tree

6 files changed

+191
-122
lines changed

6 files changed

+191
-122
lines changed

.github/generatePackageVersion.ps1

Lines changed: 0 additions & 13 deletions
This file was deleted.

.github/workflows/Build.yml

Lines changed: 186 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: Build
22

3-
on:
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
skip-duplicates:
7+
description: 'Whether to fail or skip duplicates when uploading to a package repository'
8+
required: false
9+
default: 'true'
410
pull_request:
511
branches:
612
- 'master'
@@ -21,52 +27,92 @@ jobs:
2127

2228
runs-on: windows-latest
2329

30+
outputs:
31+
NUGET_VERSION: ${{ steps.buildVariables.outputs.NUGET_PACKAGE_VERSION }}
32+
LAST_COMMITTER: ${{ steps.buildVariables.outputs.LAST_COMMITTER }}
33+
COMMIT_MESSAGE: ${{ steps.buildVariables.outputs.COMMIT_MESSAGE }}
34+
SHOULD_DEPLOY: ${{ steps.buildVariables.outputs.SHOULD_DEPLOY }}
35+
2436
steps:
2537
- name: Checkout
26-
uses: actions/checkout@v2
38+
uses: actions/checkout@v3
2739
with:
2840
fetch-depth: 0
29-
30-
- name: Install .NET Core 3.1
31-
uses: actions/setup-dotnet@v1
32-
with:
33-
dotnet-version: '3.1.x'
34-
35-
- name: Install .NET Core 5.0
36-
uses: actions/setup-dotnet@v1
37-
with:
38-
dotnet-version: '5.0.x'
3941

4042
- name: Install .NET 6
41-
uses: actions/setup-dotnet@v1
43+
uses: actions/setup-dotnet@v2
4244
with:
4345
dotnet-version: '6.0.x'
44-
include-prerelease: True
45-
46-
- uses: actions/setup-dotnet@v1
47-
with:
48-
source-url: https://nuget.pkg.github.com/genexuslabs/index.json
49-
env:
50-
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
46+
include-prerelease: false
5147

5248
- name: Calculate environment variables
53-
run: |
54-
$IsPrerelease = !($Env:GIT_REF -match 'release-[0-9]+(?:\.[0-9]+)?$')
55-
echo "IsPrerelease=$IsPrerelease" >> $env:GITHUB_ENV
49+
id: buildVariables
50+
run: |
51+
$IsMaster = $false
52+
53+
switch -regex ($Env:GIT_REF) {
54+
'master' {
55+
$IsPrerelease = $true
56+
$IsMaster = $true
57+
58+
$SHOULD_DEPLOY = 'true'
59+
}
60+
61+
'beta' {
62+
$IsPrerelease = $true
63+
64+
$SHOULD_DEPLOY = 'true'
65+
}
66+
67+
'release-*' {
68+
$IsPrerelease = $false
69+
70+
$SHOULD_DEPLOY = 'true'
71+
}
72+
73+
default {
74+
$IsPrerelease = $false
75+
76+
$SHOULD_DEPLOY = 'false'
77+
}
78+
}
79+
80+
$GetFileVersionOutput = dotnet msbuild dotnet/Directory.Build.props /t:GetFileVersionForPackage
81+
"$GetFileVersionOutput" -match "(?<=FileVersion:)(.*)" > $null
82+
$GetFileVersionOutput = $Matches[0]
83+
84+
$NUGET_PACKAGE_VERSION = $GetFileVersionOutput
85+
86+
if ($IsPrerelease -eq $true) {
87+
$VersionTag = @("trunk", "stable")[$IsMaster]
88+
$Timestamp = (Get-Date -AsUTC).ToString("yyyyMMddHHmmss")
89+
$NUGET_PACKAGE_VERSION = $NUGET_PACKAGE_VERSION + "-" + $VersionTag + "." + $Timestamp
90+
}
91+
92+
Write-Output "Packge version to be used: $NUGET_PACKAGE_VERSION"
5693
5794
$COMMIT_NUMBER = @($(git rev-list --count origin/master..), $(git rev-list --count HEAD))[$IsPrerelease]
95+
$COMMIT_MESSAGE = $(git log -1 --pretty=%B)
96+
$LAST_COMMITTER = $(git log -1 --pretty=format:%an)
97+
98+
echo "NUGET_PACKAGE_VERSION=$NUGET_PACKAGE_VERSION" >> $env:GITHUB_ENV
99+
echo "IsPrerelease=$IsPrerelease" >> $env:GITHUB_ENV
58100
59-
echo "COMMIT_NUMBER=$COMMIT_NUMBER" >> $env:GITHUB_ENV
101+
echo "::set-output name=NUGET_PACKAGE_VERSION::$NUGET_PACKAGE_VERSION"
102+
echo "::set-output name=SHOULD_DEPLOY::$SHOULD_DEPLOY"
103+
echo "::set-output name=LAST_COMMITTER::$LAST_COMMITTER"
104+
echo "::set-output name=COMMIT_MESSAGE::$COMMIT_MESSAGE"
60105
61-
- name: Calculate package version
106+
- name: Write SNK
107+
if: github.repository_owner == 'GeneXusLabs' && steps.buildVariables.outputs.SHOULD_DEPLOY == 'true'
62108
env:
63-
PackageVersionString: ./.github/generatePackageVersion.ps1
109+
SNK_BASE64: ${{ secrets.ARTECH_SNK_BASE64 }}
64110
run: |
65-
$NuGetPackageVersion = & "$Env:PackageVersionString"
66-
67-
Write-Output "Packge version to be used: $NuGetPackageVersion"
111+
$artech_snk_path = Join-Path (Get-Item .).FullName "Artech.snk"
112+
$bytes = [Convert]::FromBase64String($Env:SNK_BASE64)
113+
[IO.File]::WriteAllBytes($artech_snk_path, $bytes)
68114
69-
echo "NuGetPackageVersion=$NuGetPackageVersion" >> $env:GITHUB_ENV
115+
echo "ARTECH_SNK_FILE=$artech_snk_path" >> $env:GITHUB_ENV
70116
71117
- name: Restore packages
72118
run: dotnet restore $Env:SolutionFile
@@ -78,4 +124,113 @@ jobs:
78124
run: dotnet test $Env:SolutionFile --no-restore --no-build --configuration $Env:Configuration
79125

80126
- name: Pack
81-
run: dotnet pack $Env:SolutionFile --no-restore --no-build --configuration $Env:Configuration /p:Version=$Env:NuGetPackageVersion
127+
run: dotnet pack $Env:SolutionFile --no-restore --no-build --configuration $Env:Configuration /p:Version=$Env:NUGET_PACKAGE_VERSION
128+
129+
- name: Sign packages
130+
if: github.repository_owner == 'GeneXusLabs' && steps.buildVariables.outputs.SHOULD_DEPLOY == 'true'
131+
env:
132+
TIMESTAMPER_URL: ${{ secrets.CODE_SIGN_CERTIFICATE_TIMESTAMPER_URL }}
133+
PFX_BASE64: ${{ secrets.CODE_SIGN_CERTIFICATE_BASE64 }}
134+
PFX_PASS: ${{ secrets.CODE_SIGN_CERTIFICATE_PASSWORD }}
135+
run: |
136+
$codesign_pfx = "code_sign_cert.pfx"
137+
$bytes = [Convert]::FromBase64String($Env:PFX_BASE64)
138+
[IO.File]::WriteAllBytes($codesign_pfx, $bytes)
139+
140+
Get-ChildItem ".\dotnet\*.nupkg" -Recurse | ForEach-Object {
141+
dotnet nuget sign $_.FullName --certificate-path $codesign_pfx --certificate-password $Env:PFX_PASS --timestamper $Env:TIMESTAMPER_URL
142+
}
143+
144+
- name: Configure Azure Artifacts feed
145+
if: github.repository_owner == 'GeneXusLabs' && steps.buildVariables.outputs.SHOULD_DEPLOY == 'true'
146+
env:
147+
AzureArtifactsPrereleaseFeedURL: https://pkgs.dev.azure.com/genexuslabs/13fb82d9-57a8-49ef-95bb-0ec8324e470c/_packaging/dotnet-prereleases/nuget/v3/index.json
148+
AzureArtifactsReleaseFeedURL: https://pkgs.dev.azure.com/genexuslabs/13fb82d9-57a8-49ef-95bb-0ec8324e470c/_packaging/dotnet-releases/nuget/v3/index.json
149+
run: |
150+
$IsPrerelease = [System.Convert]::ToBoolean($Env:IsPrerelease)
151+
$AZURE_ARTIFACTS_URL = @("$Env:AzureArtifactsReleaseFeedURL", "$Env:AzureArtifactsPrereleaseFeedURL")[$IsPrerelease]
152+
153+
dotnet nuget add source $AZURE_ARTIFACTS_URL --name AzureArtifacts --username genexuslabs --password ${{ secrets.AZURE_ARTIFACTS_TOKEN }}
154+
155+
echo "AZURE_ARTIFACTS_URL=$AZURE_ARTIFACTS_URL" >> $env:GITHUB_ENV
156+
157+
- name: Push packages
158+
if: github.repository_owner == 'GeneXusLabs' && steps.buildVariables.outputs.SHOULD_DEPLOY == 'true'
159+
env:
160+
GPRFeedURL: https://nuget.pkg.github.com/genexuslabs/index.json
161+
NuGetFeedURL: https://api.nuget.org/v3/index.json
162+
run: |
163+
$IsPrerelease = [System.Convert]::ToBoolean($Env:IsPrerelease)
164+
165+
$totalPackages = 0
166+
$pushedToAzure = 0
167+
$pushedToGitHub = 0
168+
$pushedToNuget = 0
169+
170+
Get-ChildItem ".\dotnet\*.nupkg" -Recurse | ForEach-Object {
171+
$PushToGitHubArgs = @("nuget", "push", $_.FullName, "--source", $Env:GPRFeedURL, "--api-key", "${{ secrets.SECURE_TOKEN }}")
172+
$PushToNugetArgs = @("nuget", "push", $_.FullName, "--source", $Env:NuGetFeedURL, "--api-key", "${{ secrets.NUGET_ORG_TOKEN }}")
173+
$PushToAzureArgs = @("nuget", "push", $_.FullName, "--source", $Env:AZURE_ARTIFACTS_URL, "--api-key", "DUMMY-KEY")
174+
175+
if ([string]::IsNullOrEmpty("${{ github.event.inputs.skip-duplicates }}") ) {
176+
$skipDuplicates = $true
177+
} else {
178+
$skipDuplicates = [System.Convert]::ToBoolean("${{ github.event.inputs.skip-duplicates }}")
179+
}
180+
181+
if ($skipDuplicates) {
182+
$PushToNugetArgs += "--skip-duplicate"
183+
$PushToGitHubArgs += "--skip-duplicate"
184+
$PushToAzureArgs += "--skip-duplicate"
185+
}
186+
187+
dotnet $PushToAzureArgs
188+
$pushedToAzure += 1
189+
190+
if (!$IsPrerelease) {
191+
dotnet $PushToGitHubArgs
192+
$pushedToGitHub += 1
193+
194+
dotnet $PushToNugetArgs
195+
$pushedToNuget += 1
196+
}
197+
198+
$totalPackages += 1
199+
}
200+
201+
Write-Output "Number of packages found: $totalPackages"
202+
203+
Write-Output "Number of packages pushed to Azure Artifacts: $pushedToAzure"
204+
Write-Output "Number of packages pushed to GitHub: $pushedToGitHub"
205+
Write-Output "Number of packages pushed to Nuget.org: $pushedToNuget"
206+
207+
dispatch-build:
208+
name: Dispatch build result
209+
needs: build
210+
if: github.repository_owner == 'GeneXusLabs' && needs.build.outputs.SHOULD_DEPLOY == 'true'
211+
212+
runs-on: ubuntu-latest
213+
214+
concurrency:
215+
group: build-${{ github.ref }}
216+
cancel-in-progress: true
217+
218+
steps:
219+
- name: Checkout action
220+
uses: actions/checkout@v3
221+
with:
222+
repository: genexuslabs/dispatch-build-result
223+
ref: releases/v2
224+
token: ${{ secrets.SECURE_TOKEN }}
225+
path: ./tmp/.github/actions/dispatch-build-result
226+
227+
- name: Dispatch build result
228+
uses: ./tmp/.github/actions/dispatch-build-result
229+
with:
230+
component-name: ${{ github.event.inputs.repository }}
231+
branch-ref: ${{ env.GIT_REF }}
232+
new-version: ${{ needs.build.outputs.NUGET_VERSION }}
233+
committer: ${{ needs.build.outputs.LAST_COMMITTER }}
234+
commit-message: ${{ needs.build.outputs.COMMIT_MESSAGE }}
235+
token: ${{ secrets.SECURE_TOKEN }}
236+

.github/workflows/External-Storage-Tests.yml

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -24,51 +24,15 @@ jobs:
2424

2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@v2
27+
uses: actions/checkout@v3
2828
with:
2929
fetch-depth: 0
30-
31-
- name: Install .NET Core 3.1
32-
uses: actions/setup-dotnet@v1
33-
with:
34-
dotnet-version: '3.1.x'
35-
36-
- name: Install .NET Core 5.0
37-
uses: actions/setup-dotnet@v1
38-
with:
39-
dotnet-version: '5.0.x'
4030

4131
- name: Install .NET 6
42-
uses: actions/setup-dotnet@v1
32+
uses: actions/setup-dotnet@v2
4333
with:
4434
dotnet-version: '6.0.x'
45-
include-prerelease: True
46-
47-
- uses: actions/setup-dotnet@v1
48-
with:
49-
source-url: https://nuget.pkg.github.com/genexuslabs/index.json
50-
env:
51-
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
52-
53-
- name: Calculate environment variables
54-
run: |
55-
$IsPrerelease = !($Env:GIT_REF -match 'release-[0-9]+(?:\.[0-9]+)?$')
56-
echo "IsPrerelease=$IsPrerelease" >> $env:GITHUB_ENV
57-
58-
$COMMIT_NUMBER = @($(git rev-list --count origin/master..), $(git rev-list --count HEAD))[$IsPrerelease]
59-
60-
echo "COMMIT_NUMBER=$COMMIT_NUMBER" >> $env:GITHUB_ENV
61-
62-
- name: Calculate package version
63-
env:
64-
PackageVersionString: ./.github/generatePackageVersion.ps1
65-
run: |
66-
$NuGetPackageVersion = & "$Env:PackageVersionString"
67-
68-
Write-Output "Packge version to be used: $NuGetPackageVersion"
69-
70-
echo "NuGetPackageVersion=$NuGetPackageVersion" >> $env:GITHUB_ENV
71-
35+
7236
- name: Restore packages
7337
run: dotnet restore $Env:SolutionFile
7438

.github/workflows/ProcessCommit.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

dotnet/src/dotnetcore/DynService/OData/DynServiceOData.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<Compile Include="..\..\..\dotnetframework\DynServiceOData\DynServiceOData.cs" Link="DynServiceOData.cs" />
1313
</ItemGroup>
1414
<ItemGroup>
15-
<PackageReference Include="GXOdata.Client" Version="5.2.3.5" />
15+
<PackageReference Include="GeneXus.Odata.Client" Version="5.2.3.8" />
1616
<PackageReference Include="log4net" Version="2.0.11" />
1717
</ItemGroup>
1818
<ItemGroup>

dotnet/src/dotnetframework/DynServiceOData/DynServiceOData.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="GXOdata.Client" Version="5.2.3.5" />
13+
<PackageReference Include="GeneXus.Odata.Client" Version="5.2.3.8" />
1414
<PackageReference Include="log4net" Version="2.0.11" />
1515
<PackageReference Include="Microsoft.Data.Edm" Version="5.8.4" />
1616
<PackageReference Include="Microsoft.Data.OData" Version="5.8.4" />

0 commit comments

Comments
 (0)