Browse Source

Move the OfficialBuildId computation logic to build.yml

pull/1008/head
Kévin Chalet 6 years ago
parent
commit
86a1680339
  1. 22
      .github/workflows/build.yml
  2. 18
      Directory.Build.props
  3. 7
      OpenIddict.sln

22
.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

18
Directory.Build.props

@ -48,24 +48,6 @@
<Serviceable>false</Serviceable>
</PropertyGroup>
<!--
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.
-->
<PropertyGroup Condition=" '$(GITHUB_ACTIONS)' == 'true' AND '$(GITHUB_REF.StartsWith(`refs/pull/`))' == 'false' ">
<_Hours>$([MSBuild]::Multiply($([System.DateTime]::Now.ToString(HH)), 4))</_Hours>
<_QuarterHours>$([MSBuild]::Divide($([System.DateTime]::Now.ToString(mm)), 15))</_QuarterHours>
<_QuarterHours>$([System.Math]::Floor($(_QuarterHours)))</_QuarterHours>
<_GitHubActionsBuildRevision>$([MSBuild]::Add($(_Hours), $(_QuarterHours)))</_GitHubActionsBuildRevision>
<_GitHubActionsBuildRevision>$([MSBuild]::Add($(_GitHubActionsBuildRevision), 1))</_GitHubActionsBuildRevision>
<OfficialBuild>true</OfficialBuild>
<OfficialBuildId>$([System.DateTime]::Now.ToString(yyyyMMdd)).$(_GitHubActionsBuildRevision)</OfficialBuildId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" PrivateAssets="All" />

7
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

Loading…
Cancel
Save