From 86a16803390837e9dc80c3bfe83650ec5fef0898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Sat, 4 Jul 2020 15:53:05 +0200 Subject: [PATCH] Move the OfficialBuildId computation logic to build.yml --- .github/workflows/build.yml | 22 ++++++++++++++++++++-- Directory.Build.props | 18 ------------------ OpenIddict.sln | 7 +++++-- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 04d1f1a0..524d13d4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,13 +31,31 @@ jobs: - name: Setup .NET Core SDK uses: actions/setup-dotnet@v1 + # Arcade only allows the revision to contain up to two characters, and GitHub Actions does not roll-over + # build numbers every day like Azure DevOps does. To balance these two requirements, set the official + # build ID to be the same format as the built-in default from Arcade, except with the revision number + # being the number of the quarter hour of the current time of day (24 * 4 = 96, which is less than 100). + # So a build between 00:00 and 00:14 would have a revision of 1, and a build between 23:45 and 23:59:59 + # would have a revision of 97. + - name: Set Build ID + if: ${{ startsWith(github.ref, 'refs/pull/') == false }} + shell: pwsh + run: | + $Now = (Get-Date).ToUniversalTime() + $Hours = $Now.Hour * 4 + $QuarterHours = [Math]::Floor($Now.Minute / 15.0) + $Revision = $Hours + $QuarterHours + 1 + $BuildId = $Now.ToString("yyyyMMdd") + "." + $Revision + Write-Host "::set-env name=OfficialBuild::true" + Write-Host "::set-env name=OfficialBuildId::${BuildId}" + - name: Build, test and pack - run: eng\common\CIBuild.cmd -configuration Release -prepareMachine -integrationTest + run: eng\common\CIBuild.cmd -configuration Release -prepareMachine -integrationTest /p:DotNetPublishUsingPipelines=true if: ${{ runner.os == 'Windows' }} - name: Build, test and pack shell: pwsh - run: ./eng/common/cibuild.sh -configuration Release -prepareMachine -integrationTest + run: ./eng/common/cibuild.sh -configuration Release -prepareMachine -integrationTest /p:DotNetPublishUsingPipelines=true if: ${{ runner.os != 'Windows' }} - name: Publish logs diff --git a/Directory.Build.props b/Directory.Build.props index 8470e50a..04381d36 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -48,24 +48,6 @@ false - - - <_Hours>$([MSBuild]::Multiply($([System.DateTime]::Now.ToString(HH)), 4)) - <_QuarterHours>$([MSBuild]::Divide($([System.DateTime]::Now.ToString(mm)), 15)) - <_QuarterHours>$([System.Math]::Floor($(_QuarterHours))) - <_GitHubActionsBuildRevision>$([MSBuild]::Add($(_Hours), $(_QuarterHours))) - <_GitHubActionsBuildRevision>$([MSBuild]::Add($(_GitHubActionsBuildRevision), 1)) - true - $([System.DateTime]::Now.ToString(yyyyMMdd)).$(_GitHubActionsBuildRevision) - - diff --git a/OpenIddict.sln b/OpenIddict.sln index 21277ed3..b5a3c2a8 100644 --- a/OpenIddict.sln +++ b/OpenIddict.sln @@ -70,8 +70,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{F6F3C8E0-B ProjectSection(SolutionItems) = preProject .gitattributes = .gitattributes .gitignore = .gitignore - .travis.yml = .travis.yml - appveyor.yml = appveyor.yml Build.cmd = Build.cmd build.sh = build.sh Directory.Build.props = Directory.Build.props @@ -104,6 +102,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenIddict.Server.Owin.Inte EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenIddict.Server.Tests", "test\OpenIddict.Server.Tests\OpenIddict.Server.Tests.csproj", "{D94B10D3-3DD3-4829-B305-17C48833AB33}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{C5E38924-35AF-48E3-B629-A56BCBC02F04}" + ProjectSection(SolutionItems) = preProject + .github\workflows\build.yml = .github\workflows\build.yml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU