Skip to content

Commit 12309b2

Browse files
committed
Add the release workflow.
1 parent cc904b9 commit 12309b2

3 files changed

Lines changed: 49 additions & 18 deletions

File tree

.github/workflows/build.yml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
name: Build
1+
name: Build and Test
22

33
on:
44
push:
55
pull_request:
66

77
jobs:
88
Build:
9-
name: Build
9+
name: Build and Test
1010
runs-on: ubuntu-latest
1111
defaults:
1212
run:
1313
working-directory: ./src
14-
env:
15-
Version: "0.9.${{ github.RUN_NUMBER }}"
1614

1715
steps:
1816
- uses: actions/checkout@v3
@@ -26,7 +24,7 @@ jobs:
2624
run: dotnet restore
2725

2826
- name: Build
29-
run: dotnet build /p:Version=$Version --no-restore --configuration Release
27+
run: dotnet build --no-restore --configuration Release
3028

3129
- name: Test
3230
run: dotnet test --no-restore --no-build --configuration Release --logger "trx;LogFileName=test-results.trx" --collect:"XPlat Code Coverage"
@@ -59,15 +57,4 @@ jobs:
5957
with:
6058
name: Test Coverage
6159
title: Test Coverage
62-
body-file: code-coverage-results.md
63-
64-
- name: Publish to NuGet
65-
uses: tedd/publish-nuget-neo@v1.0.2
66-
if: ${{ github.ref == 'refs/heads/main' }}
67-
with:
68-
NUGET_KEY: ${{ secrets.NUGET_API_KEY }}
69-
PROJECT_FILE_PATH: src/MrKWatkins.Ast/MrKWatkins.Ast.csproj
70-
TAG_COMMIT: true
71-
PACKAGE_NAME: MrKWatkins.Ast
72-
VERSION_STATIC: ${{ env.Version }}
73-
INCLUDE_SYMBOLS: true
60+
body-file: code-coverage-results.md

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version Number'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
Release:
13+
name: Release
14+
runs-on: ubuntu-latest
15+
env:
16+
GH_TOKEN: ${{ github.token }}
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Setup .NET
22+
uses: actions/setup-dotnet@v3
23+
with:
24+
dotnet-version: 7.0.x
25+
26+
- name: Create Package
27+
run: dotnet pack ./src/ /p:Version=${{ inputs.version }} -p:SymbolPackageFormat=snupkg --configuration Release --include-symbols --output ./packages/
28+
29+
- name: Publish to NuGet
30+
run: dotnet nuget push ./packages/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
31+
32+
- name: Create Release
33+
run: gh release create v${{ inputs.version }} --generate-notes

src/Ast.sln

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1111
Directory.Packages.props = Directory.Packages.props
1212
..\License.md = ..\License.md
1313
..\ReadMe.md = ..\ReadMe.md
14-
..\.github\workflows\build.yml = ..\.github\workflows\build.yml
1514
..\.gitignore = ..\.gitignore
1615
EndProjectSection
1716
EndProject
17+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{C893FF4B-FA20-4B58-B7D3-3DA372503F01}"
18+
EndProject
19+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{2DC33C7E-4983-471B-B34B-9FFCCB0A62F9}"
20+
ProjectSection(SolutionItems) = preProject
21+
..\.github\workflows\build.yml = ..\.github\workflows\build.yml
22+
..\.github\workflows\release.yml = ..\.github\workflows\release.yml
23+
EndProjectSection
24+
EndProject
1825
Global
1926
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2027
Debug|Any CPU = Debug|Any CPU
@@ -30,4 +37,8 @@ Global
3037
{5ABE9485-D233-4371-91C0-9F66B1BAC287}.Release|Any CPU.ActiveCfg = Release|Any CPU
3138
{5ABE9485-D233-4371-91C0-9F66B1BAC287}.Release|Any CPU.Build.0 = Release|Any CPU
3239
EndGlobalSection
40+
GlobalSection(NestedProjects) = preSolution
41+
{C893FF4B-FA20-4B58-B7D3-3DA372503F01} = {0EE2E846-632C-4EA4-88D8-82A90776FC8D}
42+
{2DC33C7E-4983-471B-B34B-9FFCCB0A62F9} = {C893FF4B-FA20-4B58-B7D3-3DA372503F01}
43+
EndGlobalSection
3344
EndGlobal

0 commit comments

Comments
 (0)