-
-
Notifications
You must be signed in to change notification settings - Fork 2
114 lines (96 loc) · 3.53 KB
/
gated_plugin-dev-kit.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
name: Gated (Plugin Dev Kit)
on:
workflow_dispatch:
push:
branches:
- 'release/**'
paths:
- 'Plugins/Tum4ik.JustClipboardManager.PluginDevKit/**'
pull_request:
branches:
- 'main'
- 'release/**'
paths:
- 'Plugins/Tum4ik.JustClipboardManager.PluginDevKit/**'
jobs:
build:
name: Gated Build
runs-on: windows-latest
outputs:
version: ${{ steps.define-version.outputs.version }}
env:
Scripts: .\.github\workflows\scripts
TemporaryPfxFilePath: .\GitHubActionsWorkflow.pfx
BuildOutputPath: .\Plugins\Tum4ik.JustClipboardManager.PluginDevKit\bin\Release\net8.0-windows
PackOutputPath: .\Plugins\Tum4ik.JustClipboardManager.PluginDevKit\bin\Release\pack
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup .NET SDK
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 }}"
Write-Host "Defined version: $version" -ForegroundColor green
echo "version=$version" >> $env:GITHUB_OUTPUT
- name: Build
run: |
$version = "${{ steps.define-version.outputs.version }}"
dotnet build ./Plugins/Tum4ik.JustClipboardManager.PluginDevKit/Tum4ik.JustClipboardManager.PluginDevKit.csproj `
-c Release `
--nologo `
/p:PackageVersion=$version `
/p:Version=$version `
/p:GeneratePackageOnBuild=false `
/p:ContinuousIntegrationBuild=true
- name: Sign code files
run: |
${{ env.Scripts }}\DecodePfx.ps1 `
-Base64Pfx "${{ secrets.BASE64_ENCODED_PFX }}" `
-OutputPath ${{ env.TemporaryPfxFilePath }}
${{ env.Scripts }}\SignMyCodeFiles.ps1 `
-SigntoolPath .\signtool.exe `
-FilesDirectoryPath ${{ env.BuildOutputPath }} `
-PfxFilePath ${{ env.TemporaryPfxFilePath }} `
-PfxPassword ${{ secrets.PFX_KEY }} `
-FileNamesToInclude Tum4ik.JustClipboardManager.PluginDevKit.dll
Remove-Item -Path ${{ env.TemporaryPfxFilePath }}
- name: Pack
run: |
$version = "${{ steps.define-version.outputs.version }}"
dotnet pack ./Plugins/Tum4ik.JustClipboardManager.PluginDevKit/Tum4ik.JustClipboardManager.PluginDevKit.csproj `
-c Release `
--nologo `
--no-build `
-o ${{ env.PackOutputPath }} `
/p:PackageVersion=$version `
/p:Version=$version `
/p:IncludeSymbols=true `
/p:SymbolPackageFormat=snupkg
- name: Upload build artifacts
uses: actions/[email protected]
with:
if-no-files-found: error
name: Package
path: ${{ env.PackOutputPath }}
nuget-release:
if: github.event_name != 'pull_request' && contains(github.ref_name, 'release')
needs: build
name: Release ${{ needs.build.outputs.version }}
runs-on: windows-latest
steps:
- name: Download build artifacts
uses: actions/[email protected]
- name: NuGet push
run: |
dotnet nuget push "**/*.nupkg" `
-k ${{ secrets.NUGET_API_KEY }} `
-s https://api.nuget.org/v3/index.json