Untitled
user_3839718
powershell
2 years ago
1.4 kB
9
Indexable
# Define the development branch
$development_branch = "development"
# Check out the development branch
Write-Host "Checking out the $development_branch branch..."
git checkout $development_branch
# Check for uncommitted changes
$uncommittedChanges = git status --porcelain
if (-not [string]::IsNullOrWhiteSpace($uncommittedChanges)) {
Write-Host "You have uncommitted changes. Committing them now..."
# Prompt for commit message
$commit_message = Read-Host -Prompt "Enter commit message"
# Add all changes and commit
git add .
git commit -m $commit_message
} else {
Write-Host "No uncommitted changes."
}
# Fetch the latest tags and branches from remote
git fetch --tags
git fetch
# Get the latest tag from Git
$latest_tag = git describe --tags $(git rev-list --tags --max-count=1)
# Break the version number into major, minor, and patch
$versionParts = $latest_tag -split '\.'
$major = $versionParts[0]
$minor = $versionParts[1]
$patch = $versionParts[2]
# Increment the patch version
$patch = [int]$patch + 1
# Create a new tag
$new_tag = "$major.$minor.$patch"
Write-Host "Creating new tag: $new_tag"
git tag $new_tag
# Push the new tag and changes to the development branch
Write-Host "Pushing changes and new tag to the $development_branch branch..."
git push origin $development_branch
git push origin $new_tag
Write-Host "Script completed successfully."
Editor is loading...
Leave a Comment