Update executable names for beta and alpha paths.
This commit is contained in:
53
deploy/set-artifact-name.js
Normal file
53
deploy/set-artifact-name.js
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env node
|
||||
// Cross-platform script to set artifact naming based on version
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
// Read the package.json to get the version
|
||||
const packageJsonPath = path.join(__dirname, '..', 'package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
||||
const version = packageJson.version;
|
||||
|
||||
console.log(`Current version: ${version}`);
|
||||
|
||||
// Determine the artifact suffix based on the version
|
||||
let artifactSuffix = '';
|
||||
|
||||
if (version.includes('alpha')) {
|
||||
artifactSuffix = `alpha-${version}-`;
|
||||
console.log(`Detected alpha version, setting suffix to: ${artifactSuffix}`);
|
||||
} else if (version.includes('beta')) {
|
||||
artifactSuffix = `beta-${version}-`;
|
||||
console.log(`Detected beta version, setting suffix to: ${artifactSuffix}`);
|
||||
} else {
|
||||
artifactSuffix = '';
|
||||
console.log('Detected release version, no suffix will be added');
|
||||
}
|
||||
|
||||
// Set the environment variable for the current process
|
||||
process.env.ARTIFACT_SUFFIX = artifactSuffix;
|
||||
|
||||
console.log(`ARTIFACT_SUFFIX set to: '${artifactSuffix}'`);
|
||||
|
||||
// If arguments are passed, execute the remaining command with the environment variable set
|
||||
if (process.argv.length > 2) {
|
||||
const command = process.argv[2];
|
||||
const args = process.argv.slice(3);
|
||||
|
||||
console.log(`Executing: ${command} ${args.join(' ')}`);
|
||||
|
||||
const child = spawn(command, args, {
|
||||
stdio: 'inherit',
|
||||
env: { ...process.env, ARTIFACT_SUFFIX: artifactSuffix },
|
||||
shell: true
|
||||
});
|
||||
|
||||
child.on('close', (code) => {
|
||||
process.exit(code);
|
||||
});
|
||||
} else {
|
||||
// Just setting the environment variable
|
||||
console.log('Environment variable set. Use this script with additional arguments to run commands with the variable set.');
|
||||
}
|
||||
38
deploy/set-artifact-name.ps1
Normal file
38
deploy/set-artifact-name.ps1
Normal file
@@ -0,0 +1,38 @@
|
||||
# PowerShell script to set artifact naming based on version
|
||||
param(
|
||||
[string]$ConfigType = "imex"
|
||||
)
|
||||
|
||||
# Read the package.json to get the version
|
||||
$packageJsonPath = Join-Path $PSScriptRoot "..\package.json"
|
||||
$packageJson = Get-Content $packageJsonPath | ConvertFrom-Json
|
||||
$version = $packageJson.version
|
||||
|
||||
Write-Host "Current version: $version"
|
||||
|
||||
# Determine the artifact suffix based on the version
|
||||
$artifactSuffix = ""
|
||||
|
||||
if ($version -match "alpha") {
|
||||
$artifactSuffix = "alpha-${version}-"
|
||||
Write-Host "Detected alpha version, setting suffix to: $artifactSuffix"
|
||||
}
|
||||
elseif ($version -match "beta") {
|
||||
$artifactSuffix = "beta-${version}-"
|
||||
Write-Host "Detected beta version, setting suffix to: $artifactSuffix"
|
||||
}
|
||||
else {
|
||||
$artifactSuffix = ""
|
||||
Write-Host "Detected release version, no suffix will be added"
|
||||
}
|
||||
|
||||
# Set the environment variable
|
||||
$env:ARTIFACT_SUFFIX = $artifactSuffix
|
||||
|
||||
# Export for the current session
|
||||
[Environment]::SetEnvironmentVariable("ARTIFACT_SUFFIX", $artifactSuffix, "Process")
|
||||
|
||||
Write-Host "ARTIFACT_SUFFIX set to: '$env:ARTIFACT_SUFFIX'"
|
||||
|
||||
# Return the suffix for use in other scripts
|
||||
return $artifactSuffix
|
||||
33
deploy/set-artifact-name.sh
Normal file
33
deploy/set-artifact-name.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# Bash script to set artifact naming based on version
|
||||
|
||||
# Get the directory where this script is located
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Read the package.json to get the version
|
||||
PACKAGE_JSON_PATH="$SCRIPT_DIR/../package.json"
|
||||
VERSION=$(node -p "require('$PACKAGE_JSON_PATH').version")
|
||||
|
||||
echo "Current version: $VERSION"
|
||||
|
||||
# Determine the artifact suffix based on the version
|
||||
ARTIFACT_SUFFIX=""
|
||||
|
||||
if [[ $VERSION == *"alpha"* ]]; then
|
||||
ARTIFACT_SUFFIX="alpha-${VERSION}-"
|
||||
echo "Detected alpha version, setting suffix to: $ARTIFACT_SUFFIX"
|
||||
elif [[ $VERSION == *"beta"* ]]; then
|
||||
ARTIFACT_SUFFIX="beta-${VERSION}-"
|
||||
echo "Detected beta version, setting suffix to: $ARTIFACT_SUFFIX"
|
||||
else
|
||||
ARTIFACT_SUFFIX=""
|
||||
echo "Detected release version, no suffix will be added"
|
||||
fi
|
||||
|
||||
# Export the environment variable
|
||||
export ARTIFACT_SUFFIX="$ARTIFACT_SUFFIX"
|
||||
|
||||
echo "ARTIFACT_SUFFIX set to: '$ARTIFACT_SUFFIX'"
|
||||
|
||||
# Also write to a temporary file for sourcing in other scripts
|
||||
echo "export ARTIFACT_SUFFIX='$ARTIFACT_SUFFIX'" > "$SCRIPT_DIR/.artifact-suffix.env"
|
||||
64
deploy/test-artifact-naming-cross-platform.js
Normal file
64
deploy/test-artifact-naming-cross-platform.js
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env node
|
||||
// Cross-platform test script to demonstrate artifact naming for different versions
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
console.log('=== Artifact Naming Test (Cross-Platform) ===');
|
||||
console.log('');
|
||||
|
||||
// Get current version
|
||||
const packageJsonPath = path.join(__dirname, '..', 'package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
||||
const currentVersion = packageJson.version;
|
||||
|
||||
console.log(`Current version: ${currentVersion}`);
|
||||
|
||||
// Function to get artifact suffix
|
||||
function getArtifactSuffix(version) {
|
||||
if (version.includes('alpha')) {
|
||||
return `alpha-${version}-`;
|
||||
} else if (version.includes('beta')) {
|
||||
return `beta-${version}-`;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
// Test scenarios
|
||||
const testVersions = [
|
||||
'1.0.5', // Release version
|
||||
'1.0.5-alpha.2', // Alpha version
|
||||
'1.0.5-beta.1', // Beta version
|
||||
'2.0.0-alpha.1', // Another alpha
|
||||
'1.5.0-beta.3' // Another beta
|
||||
];
|
||||
|
||||
console.log('Test scenarios:');
|
||||
console.log('==================');
|
||||
|
||||
testVersions.forEach(version => {
|
||||
const suffix = getArtifactSuffix(version);
|
||||
|
||||
// Different artifact names for different platforms
|
||||
const windowsArtifact = `imex-partner-${suffix}x64.exe`;
|
||||
const macArtifact = `imex-partner-${suffix}x64.dmg`;
|
||||
const linuxArtifact = `imex-partner-${suffix}x64.AppImage`;
|
||||
|
||||
console.log(`Version: ${version}`);
|
||||
console.log(` Suffix: '${suffix}'`);
|
||||
console.log(` Windows: ${windowsArtifact}`);
|
||||
console.log(` Mac: ${macArtifact}`);
|
||||
console.log(` Linux: ${linuxArtifact}`);
|
||||
console.log('');
|
||||
});
|
||||
|
||||
console.log('Current configuration will produce:');
|
||||
const currentSuffix = getArtifactSuffix(currentVersion);
|
||||
console.log(` Windows: imex-partner-${currentSuffix}x64.exe`);
|
||||
console.log(` Mac: imex-partner-${currentSuffix}x64.dmg`);
|
||||
console.log(` Linux: imex-partner-${currentSuffix}x64.AppImage`);
|
||||
|
||||
console.log('');
|
||||
console.log(`Platform detected: ${process.platform}`);
|
||||
console.log(`Architecture: ${process.arch}`);
|
||||
48
deploy/test-artifact-naming.ps1
Normal file
48
deploy/test-artifact-naming.ps1
Normal file
@@ -0,0 +1,48 @@
|
||||
# Test script to demonstrate artifact naming for different versions
|
||||
Write-Host "=== Artifact Naming Test ==="
|
||||
Write-Host ""
|
||||
|
||||
# Test current version
|
||||
$packageJsonPath = ".\package.json"
|
||||
$packageJson = Get-Content $packageJsonPath | ConvertFrom-Json
|
||||
$currentVersion = $packageJson.version
|
||||
|
||||
Write-Host "Current version: $currentVersion"
|
||||
|
||||
# Function to get artifact suffix
|
||||
function Get-ArtifactSuffix($version) {
|
||||
if ($version -match "alpha") {
|
||||
return "alpha-${version}-"
|
||||
} elseif ($version -match "beta") {
|
||||
return "beta-${version}-"
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
# Test scenarios
|
||||
$testVersions = @(
|
||||
"1.0.5", # Release version
|
||||
"1.0.5-alpha.2", # Alpha version
|
||||
"1.0.5-beta.1", # Beta version
|
||||
"2.0.0-alpha.1", # Another alpha
|
||||
"1.5.0-beta.3" # Another beta
|
||||
)
|
||||
|
||||
Write-Host "Test scenarios:"
|
||||
Write-Host "=================="
|
||||
|
||||
foreach ($version in $testVersions) {
|
||||
$suffix = Get-ArtifactSuffix $version
|
||||
$artifactName = "imex-partner-${suffix}x64.exe"
|
||||
|
||||
Write-Host "Version: $version"
|
||||
Write-Host " Suffix: '$suffix'"
|
||||
Write-Host " Result: $artifactName"
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
Write-Host "Current configuration will produce:"
|
||||
$currentSuffix = Get-ArtifactSuffix $currentVersion
|
||||
$currentArtifact = "imex-partner-${currentSuffix}x64.exe"
|
||||
Write-Host " $currentArtifact"
|
||||
50
deploy/test-artifact-naming.sh
Normal file
50
deploy/test-artifact-naming.sh
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
# Test script to demonstrate artifact naming for different versions on Mac
|
||||
|
||||
echo "=== Artifact Naming Test (Mac) ==="
|
||||
echo ""
|
||||
|
||||
# Get current version
|
||||
PACKAGE_JSON_PATH="./package.json"
|
||||
CURRENT_VERSION=$(node -p "require('$PACKAGE_JSON_PATH').version")
|
||||
|
||||
echo "Current version: $CURRENT_VERSION"
|
||||
|
||||
# Function to get artifact suffix
|
||||
get_artifact_suffix() {
|
||||
local version=$1
|
||||
if [[ $version == *"alpha"* ]]; then
|
||||
echo "alpha-${version}-"
|
||||
elif [[ $version == *"beta"* ]]; then
|
||||
echo "beta-${version}-"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
# Test scenarios
|
||||
TEST_VERSIONS=(
|
||||
"1.0.5" # Release version
|
||||
"1.0.5-alpha.2" # Alpha version
|
||||
"1.0.5-beta.1" # Beta version
|
||||
"2.0.0-alpha.1" # Another alpha
|
||||
"1.5.0-beta.3" # Another beta
|
||||
)
|
||||
|
||||
echo "Test scenarios:"
|
||||
echo "=================="
|
||||
|
||||
for version in "${TEST_VERSIONS[@]}"; do
|
||||
suffix=$(get_artifact_suffix "$version")
|
||||
artifact_name="imex-partner-${suffix}x64.dmg"
|
||||
|
||||
echo "Version: $version"
|
||||
echo " Suffix: '$suffix'"
|
||||
echo " Result: $artifact_name"
|
||||
echo ""
|
||||
done
|
||||
|
||||
echo "Current configuration will produce:"
|
||||
current_suffix=$(get_artifact_suffix "$CURRENT_VERSION")
|
||||
current_artifact="imex-partner-${current_suffix}x64.dmg"
|
||||
echo " $current_artifact"
|
||||
Reference in New Issue
Block a user