-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild-and-publish.ps1
More file actions
88 lines (73 loc) · 2.71 KB
/
Copy pathbuild-and-publish.ps1
File metadata and controls
88 lines (73 loc) · 2.71 KB
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
# Quick Build and Publish Script
# This is a convenience script that combines building, testing, and publishing
param(
[Parameter(Mandatory=$true)]
[string]$Version,
[Parameter(Mandatory=$false)]
[string]$ApiKey = "",
[switch]$SkipTests = $false,
[switch]$SkipPublish = $false,
[switch]$CreateTag = $false
)
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " Quick Build and Publish - v$Version" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Step 1: Pack
Write-Host "Step 1: Building and packing..." -ForegroundColor Yellow
$packParams = @{
Version = $Version
SkipTests = $SkipTests
}
& .\pack.ps1 @packParams
if ($LASTEXITCODE -ne 0) {
Write-Host "✗ Pack failed!" -ForegroundColor Red
exit $LASTEXITCODE
}
# Step 2: Publish (optional)
if (-not $SkipPublish) {
Write-Host ""
Write-Host "Step 2: Publishing to NuGet..." -ForegroundColor Yellow
if (-not $ApiKey) {
$ApiKey = $env:NUGET_API_KEY
}
if (-not $ApiKey) {
Write-Host "⚠ Warning: No API key provided, skipping publish" -ForegroundColor Yellow
Write-Host " Use -ApiKey parameter or set NUGET_API_KEY environment variable" -ForegroundColor Gray
} else {
& .\publish.ps1 -ApiKey $ApiKey
if ($LASTEXITCODE -ne 0) {
Write-Host "✗ Publish failed!" -ForegroundColor Red
exit $LASTEXITCODE
}
}
} else {
Write-Host ""
Write-Host "Skipping publish (use -SkipPublish:`$false to publish)" -ForegroundColor Gray
}
# Step 3: Create Git Tag (optional)
if ($CreateTag) {
Write-Host ""
Write-Host "Step 3: Creating Git tag..." -ForegroundColor Yellow
$tagName = "v$Version"
git tag $tagName
if ($LASTEXITCODE -eq 0) {
Write-Host "✓ Tag '$tagName' created" -ForegroundColor Green
Write-Host " Push with: git push origin $tagName" -ForegroundColor Gray
} else {
Write-Host "⚠ Warning: Failed to create tag" -ForegroundColor Yellow
}
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " All Done! ✓" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
if (-not $SkipPublish -and $ApiKey) {
Write-Host "Package published successfully!" -ForegroundColor Green
Write-Host "View at: https://www.nuget.org/packages/EmmyLua.LanguageServer.Framework/" -ForegroundColor Cyan
} else {
Write-Host "Package created in: .\artifacts\" -ForegroundColor Green
Write-Host "To publish: .\publish.ps1 -ApiKey YOUR_KEY" -ForegroundColor Cyan
}
Write-Host ""