Skip to content

Commit 48c47e8

Browse files
committed
Add nightly build
1 parent 36b13c5 commit 48c47e8

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ on:
77
- '[0-9]+.[0-9]+.[0-9]+-*'
88
pull_request:
99
workflow_dispatch:
10+
inputs:
11+
nightly:
12+
description: 'Build as nightly version'
13+
required: false
14+
type: boolean
15+
default: false
16+
schedule:
17+
- cron: '0 15 * * *' # Run at 3 PM UTC (1 AM Melbourne AEST / 2 AM AEDT)
1018
env:
1119
DOTNET_NOLOGO: true
1220
jobs:
@@ -23,7 +31,22 @@ jobs:
2331
with:
2432
dotnet-version: 9.0.x
2533
- name: Build
26-
run: dotnet build LibGit2Sharp.sln --configuration Release
34+
run: |
35+
# if it is a pull request build set the build identity to branchname.runnumber
36+
if ("${{ github.event_name }}" -eq "pull_request" -and "${{ github.head_ref }}" -ne "") {
37+
$branchName = "${{ github.head_ref }}" -replace '[/\\]', '-' -replace '[^a-zA-Z0-9\-]', ''
38+
$buildIdentity = "$branchName.${{ github.run_number }}"
39+
40+
$env:BUILD_IDENTITY = $buildIdentity
41+
}
42+
43+
# if it is a scheduled build set the build identity to nightly
44+
if ("${{ github.event_name }}" -eq "schedule" -or "${{ inputs.nightly }}" -eq "true") {
45+
$env:BUILD_IDENTITY = "nightly.${{ github.run_number }}"
46+
}
47+
48+
dotnet build LibGit2Sharp.sln --configuration Release
49+
shell: pwsh
2750
- name: Upload packages
2851
uses: actions/upload-artifact@v4.3.1
2952
with:
@@ -105,7 +128,7 @@ jobs:
105128
name: Octopus NuGet Push
106129
needs: [build, test, test-linux]
107130
# && github.ref == 'refs/heads/octopus/master'
108-
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' && github.event_name != 'schedule'
131+
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
109132
runs-on: ubuntu-22.04
110133
steps:
111134
- uses: actions/download-artifact@v4

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
<IsTrimmable>true</IsTrimmable>
3030
</PropertyGroup>
3131

32+
<PropertyGroup Condition="'$(BUILD_IDENTITY)' != ''">
33+
<MinVerDefaultPreReleaseIdentifiers>octopus-$(BUILD_IDENTITY)</MinVerDefaultPreReleaseIdentifiers>
34+
</PropertyGroup>
35+
3236
<ItemGroup>
3337
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="[2.0.323]" PrivateAssets="none" />
3438
<PackageReference Include="MinVer" Version="6.0.0" PrivateAssets="all" />

0 commit comments

Comments
 (0)