Skip to content

Commit cba01a4

Browse files
authored
ci(): Publish release on tag (#30)
Execute `Publish-Module` whenever a new tag is pushed. Add a script to setup the CI so it can publish the module. Before publishing the package it is verified. If the dependencies are not present then it will fail.
1 parent d9dd73b commit cba01a4

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

.drone.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ steps:
2929
# Disable debugging and profiling
3030
COMPlus_EnableDiagnostics: 0
3131

32+
- name: publish
33+
image: mcr.microsoft.com/dotnet/sdk:6.0-alpine
34+
commands:
35+
- pwsh ./Publish-WebKitDev.ps1
36+
environment:
37+
NUGET_API_KEY:
38+
from_secret: nuget_api_key
39+
# Disable debugging and profiling
40+
COMPlus_EnableDiagnostics: 0
41+
when:
42+
event:
43+
- tag
44+
3245
trigger:
3346
ref:
3447
- refs/heads/master

Publish-WebKitDev.ps1

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
param(
2+
[string]$nugetApiKey
3+
)
4+
5+
$ErrorActionPreference = 'Stop';
6+
7+
if (-not ($nugetApiKey)) {
8+
$nugetApiKey = $Env:NUGET_API_KEY;
9+
10+
if (-not ($nugetApiKey)) {
11+
Write-Error 'API key is not specified on command line or in Env:NUGET_API_KEY';
12+
}
13+
}
14+
15+
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted;
16+
17+
# Need to install the modules otherwise the tests will fail
18+
if (-not (Get-Module -Name '7Zip4Powershell')) {
19+
Write-Information -MessageData 'Installing 7Zip4Powershell dependency' -InformationAction Continue;
20+
Install-Module -Name '7Zip4Powershell' -RequiredVersion 1.13.0 -Force;
21+
}
22+
23+
if (-not (Get-Module -Name 'VSSetup')) {
24+
Write-Information -MessageData 'Installing VSSetup dependency' -InformationAction Continue;
25+
Install-Module -Name 'VSSetup' -RequiredVersion 2.2.16 -Force;
26+
}
27+
28+
Write-Information -MessageData 'Publishing WebKitDev package' -InformationAction Continue;
29+
Publish-Module -Path (Join-Path $PSScriptRoot WebKitDev) -NuGetApiKey $nugetApiKey -Force;

0 commit comments

Comments
 (0)