From 10f22d6ab0d43bc4954f635ce638f0dfd530e50d Mon Sep 17 00:00:00 2001 From: Tyler Mairose Date: Fri, 26 Jun 2026 16:42:19 -0400 Subject: [PATCH] Fix release version and release scripts --- .github/workflows/release.yaml | 10 ------- PSSailpoint/Build.ps1 | 2 +- PSSailpoint/PSSailpoint.psd1 | 2 +- sdk-resources/build-versioned-sdk.js | 44 ++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7f5428301..9e2d162e5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -133,16 +133,6 @@ jobs: yq -i ".packageVersion = \"$VERSION\"" sdk-resources/v2025-nerm-config.yaml sed -i "s/const PACKAGE_VERSION = \"[^\"]*\"/const PACKAGE_VERSION = \"$VERSION\"/" sdk-resources/build-versioned-sdk.js - - name: Update Build.ps1 ModuleVersion - shell: bash - run: | - LATEST="${{ steps.version.outputs.latest }}" - NEW="${{ steps.version.outputs.new }}" - LATEST_ESCAPED="${LATEST//./\\.}" - cd PSSailpoint - sed -e "s/ModuleVersion = '${LATEST_ESCAPED}'/ModuleVersion = '${NEW}'/g" Build.ps1 > Build.ps1.tmp && mv Build.ps1.tmp Build.ps1 - sed -e "s/RequiredVersion = '${LATEST_ESCAPED}'/RequiredVersion = '${NEW}'/g" Build.ps1 > Build.ps1.tmp && mv Build.ps1.tmp Build.ps1 - - name: Build SDK uses: ./.github/actions/build-sdk diff --git a/PSSailpoint/Build.ps1 b/PSSailpoint/Build.ps1 index 5fa779bfc..e35b169a3 100644 --- a/PSSailpoint/Build.ps1 +++ b/PSSailpoint/Build.ps1 @@ -7,7 +7,7 @@ $Manifest = @{ CompanyName = 'SailPoint Technologies' Description = 'PSSailpoint - the PowerShell module for IdentityNow' - ModuleVersion = '1.0.0' + ModuleVersion = '2.0.1' RootModule = 'PSSailpoint.psm1' Guid = '7A197170-97E8-4DCD-A171-271D4AEC2F36' # Must stay static diff --git a/PSSailpoint/PSSailpoint.psd1 b/PSSailpoint/PSSailpoint.psd1 index 3e1836085..b7124b72b 100644 --- a/PSSailpoint/PSSailpoint.psd1 +++ b/PSSailpoint/PSSailpoint.psd1 @@ -12,7 +12,7 @@ RootModule = 'PSSailpoint.psm1' # Version number of this module. -ModuleVersion = '1.0.0' +ModuleVersion = '2.0.1' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/sdk-resources/build-versioned-sdk.js b/sdk-resources/build-versioned-sdk.js index 6f723d1c1..3385aaabe 100644 --- a/sdk-resources/build-versioned-sdk.js +++ b/sdk-resources/build-versioned-sdk.js @@ -491,6 +491,46 @@ function generateBarrelModule() { console.log(` Wrote PSSailpoint/PSSailpoint.psm1 with ${partitionDirs.length} partition imports + Get-SailPointCommand`); } +// --------------------------------------------------------------------------- +// Sync the main PSSailpoint module version to PACKAGE_VERSION. +// +// Unlike the partition modules (whose manifests are fully generated by +// openapi-generator from packageVersion), the main wrapper's Build.ps1 and +// PSSailpoint.psd1 are hand-maintained. To keep PACKAGE_VERSION as the single +// source of truth, we patch only their ModuleVersion line in place and leave +// the rest of each file untouched. +// --------------------------------------------------------------------------- + +function syncMainModuleVersion() { + const psSailpointDir = path.join(SDK_ROOT, "PSSailpoint"); + + // (label, file path, regex matching the ModuleVersion assignment). + // Build.ps1 pads with spaces ("ModuleVersion = '...'"); the psd1 does not. + const targets = [ + ["PSSailpoint/Build.ps1", path.join(psSailpointDir, "Build.ps1"), /(ModuleVersion\s*=\s*)'[^']*'/], + ["PSSailpoint/PSSailpoint.psd1", path.join(psSailpointDir, "PSSailpoint.psd1"), /(ModuleVersion\s*=\s*)'[^']*'/], + ]; + + for (const [label, filePath, re] of targets) { + if (!fs.existsSync(filePath)) { + console.log(` ${label} not found, skipping version sync.`); + continue; + } + const original = fs.readFileSync(filePath, "utf8"); + if (!re.test(original)) { + console.log(` WARNING: no ModuleVersion line found in ${label}, skipping.`); + continue; + } + const updated = original.replace(re, `$1'${PACKAGE_VERSION}'`); + if (updated !== original) { + fs.writeFileSync(filePath, updated, "utf8"); + console.log(` Set ${label} ModuleVersion → ${PACKAGE_VERSION}`); + } else { + console.log(` ${label} ModuleVersion already ${PACKAGE_VERSION}`); + } + } +} + // --------------------------------------------------------------------------- // Main // --------------------------------------------------------------------------- @@ -618,6 +658,10 @@ async function main() { console.log("\n[BARREL] Regenerating PSSailpoint/PSSailpoint.psm1 ..."); generateBarrelModule(); + // Keep the hand-maintained main module manifest in sync with PACKAGE_VERSION. + console.log("\n[VERSION] Syncing main PSSailpoint module version ..."); + syncMainModuleVersion(); + // Write error reports if (results.failed.length > 0) { const summaryPath = writeSummaryReport(results, apisDir);