Skip to content

Commit 9b61f35

Browse files
committed
feat: completes 4series update
1 parent 1bc0c4e commit 9b61f35

39 files changed

Lines changed: 427 additions & 811 deletions
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
$latestVersions = $(git tag --merged origin/main)
2+
$latestVersion = [version]"0.0.0"
3+
Foreach ($version in $latestVersions) {
4+
Write-Host $version
5+
try {
6+
if (([version]$version) -ge $latestVersion) {
7+
$latestVersion = $version
8+
Write-Host "Setting latest version to: $latestVersion"
9+
}
10+
}
11+
catch {
12+
Write-Host "Unable to convert $($version). Skipping"
13+
continue;
14+
}
15+
}
16+
17+
$newVersion = [version]$latestVersion
18+
$phase = ""
19+
$newVersionString = ""
20+
switch -regex ($Env:GITHUB_REF) {
21+
'^refs\/heads\/main*.' {
22+
$newVersionString = "{0}.{1}.{2}" -f $newVersion.Major, $newVersion.Minor, $newVersion.Build
23+
}
24+
'^refs\/heads\/feature\/*.' {
25+
$phase = 'alpha'
26+
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
27+
}
28+
'^refs\/heads\/release\/*.' {
29+
$splitRef = $Env:GITHUB_REF -split "/"
30+
$version = [version]($splitRef[-1] -replace "v", "")
31+
$phase = 'rc'
32+
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $version.Major, $version.Minor, $version.Build, $phase, $Env:GITHUB_RUN_NUMBER
33+
}
34+
'^refs\/heads\/dev*.' {
35+
$phase = 'beta'
36+
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
37+
}
38+
'^refs\/heads\/hotfix\/*.' {
39+
$phase = 'hotfix'
40+
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
41+
}
42+
}
43+
44+
45+
Write-Output $newVersionString
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
function Update-SourceVersion {
2+
Param ([string]$Version)
3+
#$fullVersion = $Version
4+
$baseVersion = [regex]::Match($Version, "(\d+.\d+.\d+).*").captures.groups[1].value
5+
$NewAssemblyVersion = AssemblyVersion(" + $baseVersion + .*")
6+
Write-Output "AssemblyVersion = $NewAssemblyVersion"
7+
$NewAssemblyInformationalVersion = AssemblyInformationalVersion(" + $Version + ")
8+
Write-Output "AssemblyInformationalVersion = $NewAssemblyInformationalVersion"
9+
10+
foreach ($o in $input) {
11+
Write-output $o.FullName
12+
$TmpFile = $o.FullName + .tmp
13+
get-content $o.FullName |
14+
ForEach-Object {
15+
$_ -replace AssemblyVersion\(".*"\), $NewAssemblyVersion } |
16+
ForEach-Object {
17+
$_ -replace AssemblyInformationalVersion\(".*"\), $NewAssemblyInformationalVersion
18+
} > $TmpFile
19+
move-item $TmpFile $o.FullName -force
20+
}
21+
}
22+
23+
function Update-AllAssemblyInfoFiles ( $version ) {
24+
foreach ($file in AssemblyInfo.cs, AssemblyInfo.vb ) {
25+
get-childitem -Path $Env:GITHUB_WORKSPACE -recurse | Where-Object { $_.Name -eq $file } | Update-SourceVersion $version ;
26+
}
27+
}
28+
29+
# validate arguments
30+
$r = [System.Text.RegularExpressions.Regex]::Match($args[0], "\d+\.\d+\.\d+.*");
31+
if ($r.Success) {
32+
Write-Output "Updating Assembly Version to $args ...";
33+
Update-AllAssemblyInfoFiles $args[0];
34+
}
35+
else {
36+
Write-Output ;
37+
Write-Output Error: Input version does not match x.y.z format!
38+
Write-Output ;
39+
Write-Output "Unable to apply version to AssemblyInfo.cs files";
40+
}

.github/scripts/ZipBuildOutput.ps1

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Uncomment these for local testing
2+
# $Env:GITHUB_WORKSPACE = "C:\Working Directories\PD\essentials"
3+
# $Env:SOLUTION_FILE = "PepperDashEssentials"
4+
# $Env:VERSION = "0.0.0-buildType-test"
5+
6+
# Sets the root directory for the operation
7+
$destination = "$($Env:GITHUB_HOME)\output"
8+
New-Item -ItemType Directory -Force -Path ($destination)
9+
Get-ChildItem ($destination)
10+
$exclusions = @(git submodule foreach --quiet 'echo $name')
11+
# Trying to get any .json schema files (not currently working)
12+
# Gets any files with the listed extensions.
13+
Get-ChildItem -recurse -Path "$($Env:GITHUB_WORKSPACE)" -include "*.cplz" | ForEach-Object {
14+
$allowed = $true;
15+
# Exclude any files in submodules
16+
foreach ($exclude in $exclusions) {
17+
if ((Split-Path $_.FullName -Parent).contains("$($exclude)")) {
18+
$allowed = $false;
19+
break;
20+
}
21+
}
22+
if ($allowed) {
23+
Write-Host "allowing $($_)"
24+
$_;
25+
}
26+
} | Copy-Item -Destination ($destination) -Force
27+
Write-Host "Getting matching files..."
28+
# Get any files from the output folder that match the following extensions
29+
Get-ChildItem -Path $destination | Where-Object {($_.Extension -eq ".clz") -or ($_.Extension -eq ".cpz" -or ($_.Extension -eq ".cplz"))} | ForEach-Object {
30+
# Replace the extensions with dll and xml and create an array
31+
$filenames = @($($_ -replace "cpz|clz|cplz", "dll"), $($_ -replace "cpz|clz|cplz", "xml"))
32+
Write-Host "Filenames:"
33+
Write-Host $filenames
34+
if ($filenames.length -gt 0) {
35+
# Attempt to get the files and return them to the output directory
36+
Get-ChildItem -Recurse -Path "$($Env:GITHUB_WORKSPACE)" -include $filenames | Copy-Item -Destination ($destination) -Force
37+
}
38+
}
39+
Get-ChildItem -Path $destination\*.cplz | Rename-Item -NewName { "$($_.BaseName)-$($Env:VERSION)$($_.Extension)" }
40+
Compress-Archive -Path $destination -DestinationPath "$($Env:GITHUB_WORKSPACE)\$($Env:SOLUTION_FILE)-$($Env:VERSION).zip" -Force
41+
Write-Host "Output Contents post Zip"
42+
Get-ChildItem -Path $destination
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Build Essentials Plugin
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
8+
jobs:
9+
getVersion:
10+
uses: PepperDash/workflow-templates/.github/workflows/essentialsplugins-getversion.yml@main
11+
secrets: inherit
12+
13+
build-4Series:
14+
uses: PepperDash/workflow-templates/.github/workflows/essentialsplugins-4Series-builds.yml@main
15+
secrets: inherit
16+
needs: getVersion
17+
if: needs.getVersion.outputs.newVersion == 'true'
18+
with:
19+
newVersion: ${{ needs.getVersion.outputs.newVersion }}
20+
version: ${{ needs.getVersion.outputs.version }}
21+
tag: ${{ needs.getVersion.outputs.tag }}
22+
channel: ${{ needs.getVersion.outputs.channel }}

.github/workflows/essentialsplugins-betabuilds-caller.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)