forked from eclipse-aaspe/server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clean up pipeline scripts and allow usage of semantic versioning (ecl…
…ipse-aaspe#268) Update the process for creating versions: Update the Changelog Move all current changes to the [Released] section in the changelog. Determine the new version number based on semantic versioning and add the release date. Update the Version Configuration Use the new version number to update the current_version.cfg. Push Changes Push these changes to the branch you want to release from (main/develop/or your branch). Create a New Version Tag on GitHub Go to GitHub and create a new version tag on the branch. This tag should be the full version string, such as "0.3.0-1-aasV3-alpha-develop". The build number can be omitted in the tag name.
- Loading branch information
Showing
7 changed files
with
201 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,79 +9,62 @@ jobs: | |
Build-and-package-release: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Infer the version from the github ref | ||
- name: Infer the version from the GitHub ref | ||
id: inferVersion | ||
run: | | ||
$prefix = "refs/tags/v" | ||
if (!${env:GITHUB_REF}.StartsWith($prefix)) | ||
{ | ||
throw "Unexpected GITHUB_REF: ${env:GITHUB_REF}" | ||
} | ||
$version = ${env:GITHUB_REF}.Substring($prefix.Length) | ||
Write-Host "The version is: $version" | ||
if ($version.Contains("'")) | ||
{ | ||
throw "Unexpected version containing a single quote: $version" | ||
} | ||
if ($version.Contains('"')) | ||
{ | ||
throw "Unexpected version containing a double quote: $version" | ||
} | ||
if ($version.Contains(':')) | ||
{ | ||
throw "Unexpected version containing a full colon: $version" | ||
} | ||
$version = .\GetVersion.ps1 -suffix alpha | ||
echo "::set-output name=version::$version" | ||
shell: pwsh | ||
|
||
Write-Output "::set-output name=version::$version" | ||
- name: Install .NET core | ||
uses: actions/setup-dotnet@v1 | ||
- name: Install .NET Core | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: '6.0.x' | ||
|
||
- name: Build for the release | ||
- name: Build for release | ||
working-directory: src | ||
run: .\BuildForRelease.ps1 | ||
shell: pwsh | ||
|
||
- name: Update version numbers in project | ||
working-directory: src | ||
run: powershell .\BuildForRelease.ps1 | ||
run: .\UpdateProjectVersions.ps1 -version ${{ steps.inferVersion.outputs.version }} | ||
shell: pwsh | ||
|
||
- name: Package the release | ||
working-directory: src | ||
run: | | ||
$version = '${{ steps.inferVersion.outputs.version }}' | ||
Write-Host "Packaging for the release version: $version" | ||
powershell .\PackageRelease.ps1 -version $version | ||
.\PackageRelease.ps1 -version $version | ||
shell: pwsh | ||
|
||
- name: Rename the release assets | ||
working-directory: ./ | ||
working-directory: . | ||
run: | | ||
Write-Host "Current working directory: $(Get-Location)" | ||
$version = '${{ steps.inferVersion.outputs.version }}' | ||
$releaseDir = Join-Path $(Get-Location) "artefacts\release\$version" | ||
Write-Host "Release directory: $releaseDir" | ||
if (!(Test-Path $releaseDir)) | ||
{ | ||
if (!(Test-Path $releaseDir)) { | ||
throw "The release directory does not exist: $releaseDir" | ||
} | ||
$archives = Get-ChildItem $releaseDir -Filter *.zip | ||
foreach($archive in $archives) | ||
{ | ||
foreach($archive in $archives) { | ||
$path = $archive.FullName | ||
Write-Host "The path to the archive is: $path" | ||
$nameWoExt = [io.path]::GetFileNameWithoutExtension($path) | ||
Write-Host "The name without extension is: $nameWoExt" | ||
$target = Join-Path $releaseDir ($nameWoExt + "." + $version + ".zip") | ||
Write-Host "Moving: $path -> $target" | ||
Move-Item -Path $path -Destination $target | ||
} | ||
shell: pwsh | ||
|
||
- name: Upload the release assets | ||
uses: AButler/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
param( | ||
[Parameter(HelpMessage = "Suffix to be appended to the version (e.g., alpha, beta)", Mandatory = $false)] | ||
[string] | ||
$suffix = "alpha" | ||
) | ||
|
||
# Set error action preference to stop on errors. | ||
$ErrorActionPreference = "Stop" | ||
|
||
function GetNextBuildNumber | ||
{ | ||
# Read the current build number from the file. | ||
$currentBuild = Get-Content (Join-Path $PSScriptRoot "current_build_number.cfg") | ForEach-Object { $_.Trim() } | ||
|
||
# Increment the build number and save it back to the file. | ||
$nextBuild = [int]$currentBuild + 1 | ||
$nextBuild | Set-Content (Join-Path $PSScriptRoot "current_build_number.cfg") | ||
|
||
# Return the incremented build number. | ||
return $nextBuild | ||
} | ||
|
||
function GetVersionCore | ||
{ | ||
# Read the current version from the file. | ||
$versionCore = Get-Content (Join-Path $PSScriptRoot "current_version.cfg") | ForEach-Object { $_.Trim() } | ||
|
||
# Return the version core. | ||
return $versionCore | ||
} | ||
|
||
function GetBuildSuffix | ||
{ | ||
# Determine if the build is on the main or release branch. | ||
$branch = git branch --show-current 2> $null # Suppress errors if not in a Git repository | ||
if (-not $?) | ||
{ | ||
Write-Host "Not in a Git repository. Assuming develop branch." | ||
return "develop" | ||
} | ||
|
||
if ($branch -eq "main") | ||
{ | ||
return "latest" | ||
} | ||
elseif ($branch -eq "release") | ||
{ | ||
return "stable" | ||
} | ||
else | ||
{ | ||
Write-Host "Not main or release branch. Assuming develop branch." | ||
return "develop" | ||
} | ||
} | ||
|
||
function GetVersion | ||
{ | ||
# Get the version core from the file. | ||
$versionCore = GetVersionCore | ||
|
||
# Get the build suffix based on the branch. | ||
$buildSuffix = GetBuildSuffix | ||
|
||
# Get the next build number. | ||
$buildNumber = GetNextBuildNumber | ||
|
||
$aasmodel = "aasV3" | ||
|
||
# Construct the semantic version. | ||
$semanticVersion = "$versionCore-$buildNumber-$aasmodel-$suffix-$buildSuffix" | ||
|
||
return $semanticVersion | ||
} | ||
|
||
# Generate the version and print it to output. | ||
$version = GetVersion | ||
Write-Output $version |
Oops, something went wrong.