-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.ps1
More file actions
132 lines (110 loc) · 5.19 KB
/
deploy.ps1
File metadata and controls
132 lines (110 loc) · 5.19 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
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
# Clean .locks directories from project-local-repo (Maven 4 artifact)
Get-ChildItem -Path . -Filter ".locks" -Recurse -Force -Directory -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
# Maven 4 file-locking creates .locks dirs inside central-staging which corrupts Central bundles
$noLocks = "-Daether.syncContext.named.factory=noop"
# Deploy Versioner BOM first (foundation for all other BOMs)
mvn -B -ntp clean deploy `
--file GuicedEE/bom/Versioner/pom.xml `
-DskipTests "-Dmaven.consumer.pom=false" `
"-Dcentral.publishing.skip=false" "-Dmaven.deploy.skip=true" `
"-Dgpg.passphrase=$env:MAVEN_GPG_PASSPHRASE" `
$noLocks `
-U `
@args
if ($LASTEXITCODE -ne 0) { Write-Host "Versioner deploy failed"; exit $LASTEXITCODE }
# Clean .locks again before batch deploy
Get-ChildItem -Path . -Filter ".locks" -Recurse -Force -Directory -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
# Deploy all GuicedEE BOMs + parent in a single reactor (single Central deployment bundle)
Write-Host "──── Deploying GuicedEE BOMs + Parent (single bundle) ────"
mvn -B -ntp deploy `
--file GuicedEE/deploy-boms.xml `
-DskipTests "-Dmaven.consumer.pom=false" `
"-Dcentral.publishing.skip=false" "-Dmaven.deploy.skip=true" `
"-Dgpg.passphrase=$env:MAVEN_GPG_PASSPHRASE" `
$noLocks `
-U @args
if ($LASTEXITCODE -ne 0) { Write-Host "GuicedEE BOMs deploy failed"; exit $LASTEXITCODE }
# Clean .locks before GuicedEE modules deploy
Get-ChildItem -Path . -Filter ".locks" -Recurse -Force -Directory -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
# Batch deploy GuicedEE modules namespace (modules + services + entityassist)
mvn -B -ntp deploy `
"-Pguicedee,services,entityassist" `
-DskipTests "-Dmaven.consumer.pom=false" `
"-Dcentral.publishing.skip=false" "-Dmaven.deploy.skip=true" `
"-Dgpg.passphrase=$env:MAVEN_GPG_PASSPHRASE" `
$noLocks `
-U `
@args
if ($LASTEXITCODE -ne 0) { Write-Host "GuicedEE deploy failed"; exit $LASTEXITCODE }
# Clean .locks before JWebMP deploy
Get-ChildItem -Path . -Filter ".locks" -Recurse -Force -Directory -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
# Deploy JWebMP BOMs individually
$jwebmpBoms = @(
"JWebMP/bom/pom.xml",
"JWebMP/parent/pom.xml"
)
foreach ($pom in $jwebmpBoms) {
Write-Host "──── Deploying $pom ────"
Get-ChildItem -Path . -Filter ".locks" -Recurse -Force -Directory -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
mvn -B -ntp deploy `
--file $pom `
-DskipTests "-Dmaven.consumer.pom=false" `
"-Dcentral.publishing.skip=false" "-Dmaven.deploy.skip=true" `
"-Dgpg.passphrase=$env:MAVEN_GPG_PASSPHRASE" `
$noLocks `
-U @args
if ($LASTEXITCODE -ne 0) { Write-Host "$pom deploy failed"; exit $LASTEXITCODE }
}
# Clean .locks before JWebMP modules deploy
Get-ChildItem -Path . -Filter ".locks" -Recurse -Force -Directory -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
# Batch deploy JWebMP modules namespace
mvn -B -ntp clean deploy `
"-Pjwebmp" `
-DskipTests "-Dmaven.consumer.pom=false" `
"-Dcentral.publishing.skip=false" "-Dmaven.deploy.skip=true" `
"-Dgpg.passphrase=$env:MAVEN_GPG_PASSPHRASE" `
$noLocks `
-U `
@args
if ($LASTEXITCODE -ne 0) { Write-Host "JWebMP deploy failed"; exit $LASTEXITCODE }
# Clean .locks before Activity Master deploy
Get-ChildItem -Path . -Filter ".locks" -Recurse -Force -Directory -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
# Batch deploy Activity Master namespace (bom + parent + modules)
mvn -B -ntp deploy `
"-Pactivity-master" `
-DskipTests "-Dmaven.consumer.pom=false" `
"-Dcentral.publishing.skip=false" "-Dmaven.deploy.skip=true" `
"-Dgpg.passphrase=$env:MAVEN_GPG_PASSPHRASE" `
$noLocks `
-U `
@args
if ($LASTEXITCODE -ne 0) { Write-Host "Activity Master deploy failed"; exit $LASTEXITCODE }
# -- Create Git Tag & Release (non-SNAPSHOT only) ----------
$version = (Select-Xml -Path "pom.xml" -XPath "//*[local-name()='project']/*[local-name()='version']").Node.InnerText
if ($version -notmatch "SNAPSHOT") {
$tag = "v$version"
$existingTag = git tag -l $tag
if (-not $existingTag) {
Write-Host "──── Creating tag $tag ────"
# Build release notes from previous tag
$prevTag = git describe --tags --abbrev=0 2>$null
if ($prevTag) {
$notes = git --no-pager log "$prevTag..HEAD" --pretty=format:"- %s (%h)" | Out-String
if (-not $notes.Trim()) { $notes = "Release $version" }
} else {
$notes = "Initial release $version"
}
git tag -a $tag -m "Release $version"
git push origin $tag
# Create GitHub release if gh CLI is available
if (Get-Command gh -ErrorAction SilentlyContinue) {
gh release create $tag --title "Release $version" --notes $notes
} else {
Write-Host "gh CLI not found - tag pushed but GitHub Release not created"
}
} else {
Write-Host "Tag $tag already exists, skipping release creation"
}
} else {
Write-Host "SNAPSHOT version ($version) - skipping tag/release"
}