Skip to content

Commit 9b5d236

Browse files
committed
Add new build scripts
1 parent d700953 commit 9b5d236

File tree

5 files changed

+45
-14
lines changed

5 files changed

+45
-14
lines changed

.github/workflows/generic-build.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Generic build
33
on:
44
push:
55
branches:
6-
- 'master'
6+
- 'main'
77
tags-ignore:
88
- '**'
99

@@ -19,10 +19,13 @@ jobs:
1919
runs-on: ubuntu-latest
2020

2121
steps:
22-
- uses: actions/[email protected]
23-
- name: Setup .NET Core 8.0
24-
uses: actions/[email protected]
22+
- name: Checkout repo
23+
uses: actions/[email protected]
24+
- name: Setup .NET Core 9.0
25+
uses: actions/[email protected]
2526
with:
26-
dotnet-version: '8.0.x'
27+
dotnet-version: '9.0.x'
2728
- name: Build
28-
run: dotnet build -c Release FastEnum.sln
29+
shell: pwsh
30+
run: |
31+
./Scripts/Build.ps1

.github/workflows/nuget-release.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@ jobs:
1717
runs-on: ubuntu-latest
1818

1919
steps:
20-
- uses: actions/[email protected]
21-
- name: Setup .NET Core 8.0
22-
uses: actions/[email protected]
20+
- name: Checkout repo
21+
uses: actions/[email protected]
22+
- name: Setup .NET Core 9.0
23+
uses: actions/[email protected]
2324
with:
24-
dotnet-version: '8.0.x'
25-
- name: Pack release
26-
run: dotnet pack -c Release -o tmp FastEnum.sln
27-
- name: Upload to nuget
28-
run: dotnet nuget push --skip-duplicate -k ${{secrets.NUGET_KEY}} -s https://api.nuget.org/v3/index.json tmp/*
25+
dotnet-version: '9.0.x'
26+
- name: Publish
27+
shell: pwsh
28+
env:
29+
NUGET_KEY: ${{secrets.NUGET_KEY}}
30+
PWSHG_KEY: ${{secrets.PWSHG_KEY}}
31+
run: |
32+
./Scripts/Publish.ps1

FastEnum.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Project", "Project", "{6A21
6969
EndProject
7070
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastEnum.Tests.Functionality", "Src\FastEnum.Tests.Functionality\FastEnum.Tests.Functionality.csproj", "{0AC60E27-303B-4777-8FF5-7B0C86B94E00}"
7171
EndProject
72+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Scripts", "_Scripts", "{71F6AEEB-6ABA-4A87-A427-7BBCC0067011}"
73+
ProjectSection(SolutionItems) = preProject
74+
Scripts\Build.ps1 = Scripts\Build.ps1
75+
Scripts\Publish.ps1 = Scripts\Publish.ps1
76+
EndProjectSection
77+
EndProject
7278
Global
7379
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7480
Debug|Any CPU = Debug|Any CPU

Scripts/Build.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
$Config = "Release"
2+
$Root = "$PSScriptRoot/.."
3+
4+
dotnet build $Root/FastEnum.sln -c $Config

Scripts/Publish.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
$Config = "Release"
2+
$Root = (Resolve-Path "$PSScriptRoot/..").Path
3+
$PublishDir = "$Root/Publish"
4+
5+
# Clean up
6+
Remove-Item -Path $PublishDir/* -Recurse -Force -ErrorAction Ignore | Out-Null
7+
8+
# Pack the NuGet files
9+
dotnet pack $Root/FastEnum.sln -p:ContinuousIntegrationBuild=true -c $Config -o $PublishDir
10+
11+
# Push to NuGet
12+
Get-ChildItem -Path "$PublishDir/*.nupkg" | ForEach-Object {
13+
dotnet nuget push $_.FullName --api-key $env:NUGET_KEY --source https://api.nuget.org/v3/index.json
14+
}

0 commit comments

Comments
 (0)