-
Notifications
You must be signed in to change notification settings - Fork 2
155 lines (130 loc) · 4.24 KB
/
release-2.0.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Release 2.0
on:
workflow_dispatch:
push:
branches:
- 'release/**'
pull_request:
branches:
- 'main'
- 'release/**'
paths-ignore:
- '.attachments/**'
- '.editorconfig'
- '.gitignore'
- 'LICENSE'
- 'README.md'
jobs:
build:
name: Build 2.0
runs-on: windows-latest
outputs:
version: ${{ steps.define-version.outputs.version }}
env:
Scripts: .\.github\workflows\scripts
TemporaryPfxFilePath: .\GitHubActionsWorkflow.pfx
BuildOutputPath: .\Tum4ik.StinimGen\bin\Release\netstandard2.0
PackOutputPath: .\Tum4ik.StinimGen\bin\Release\pack
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Install .NET
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
- name: Define version
id: define-version
run: |
$majorMinor = "${{ github.ref_name }}".Split("/")[-1]
if (![System.Version]::TryParse($majorMinor, [ref]$null)) { $majorMinor = "0.0" }
$buildNumber = "$(Get-Date -Format 'yy')$((Get-Date).DayOfYear.ToString().PadLeft(3, '0'))"
$version = "$majorMinor.$buildNumber.${{ github.run_number }}"
echo "version=$version-rc" >> $env:GITHUB_OUTPUT
- name: Build
run: |
$version = "${{ steps.define-version.outputs.version }}"
dotnet build `
-c Release `
--nologo `
/p:PackageVersion=$version `
/p:Version=$version `
/p:GeneratePackageOnBuild=false `
/p:ContinuousIntegrationBuild=true
- name: Test
run: |
dotnet test `
-c Release `
--nologo `
--no-build
- name: Sign code files
run: |
${{ env.Scripts }}\DecodePfx.ps1 `
-Base64Pfx "${{ secrets.BASE64_ENCODED_PFX }}" `
-OutputPath ${{ env.TemporaryPfxFilePath }}
${{ env.Scripts }}\SignMyCodeFiles.ps1 `
-FilesDirectoryPath ${{ env.BuildOutputPath }} `
-PfxFilePath ${{ env.TemporaryPfxFilePath }} `
-PfxPassword ${{ secrets.PFX_KEY }}
${{ env.Scripts }}\SignMyCodeFiles.ps1 `
-FilesDirectoryPath .\Tum4ik.StinimGen.Attributes\bin\Release\netstandard2.0 `
-PfxFilePath ${{ env.TemporaryPfxFilePath }} `
-PfxPassword ${{ secrets.PFX_KEY }}
Remove-Item -Path ${{ env.TemporaryPfxFilePath }}
- name: Pack
run: |
$version = "${{ steps.define-version.outputs.version }}"
dotnet pack .\Tum4ik.StinimGen\Tum4ik.StinimGen.csproj `
-c Release `
--nologo `
--no-build `
-o ${{ env.PackOutputPath }} `
/p:PackageVersion=$version `
/p:Version=$version `
/p:IncludeSymbols=true `
/p:SymbolPackageFormat=snupkg
- name: Upload package
uses: actions/[email protected]
with:
if-no-files-found: error
name: Package
path: ${{ env.PackOutputPath }}
- name: Upload release notes
uses: actions/[email protected]
with:
if-no-files-found: error
name: ReleaseNotes
path: .\SolutionProperties\ReleaseNotes.txt
nuget-release:
name: NuGet Release ${{ needs.build.outputs.version }}
if: github.event_name != 'pull_request' && contains(github.ref_name, 'release')
needs: build
runs-on: windows-latest
steps:
- name: Download build artifacts
uses: actions/[email protected]
with:
name: Package
- name: NuGet push
run: |
dotnet nuget push "**/*.nupkg" `
-s https://api.nuget.org/v3/index.json `
-k ${{ secrets.NUGET_API_KEY }}
github-release:
name: GitHub Release ${{ needs.build.outputs.version }}
if: github.event_name != 'pull_request' && contains(github.ref_name, 'release')
needs: build
runs-on: windows-latest
steps:
- name: Download build artifacts
uses: actions/[email protected]
with:
name: ReleaseNotes
- name: GitHub release
uses: softprops/[email protected]
with:
tag_name: ${{ needs.build.outputs.version }}
draft: false
body_path: ReleaseNotes.txt
fail_on_unmatched_files: true