Compare commits

...

4 Commits

Author SHA1 Message Date
Your Name
2c699652b0 v0.2.8 - Almost Final test of fixed versioning system 2025-09-06 05:14:03 -04:00
Your Name
2e4ffc0e79 Add force push for updated tags 2025-09-06 05:11:11 -04:00
Your Name
70c91ec858 Fix version.h generation timing in build script 2025-09-06 05:09:35 -04:00
Your Name
b7c4609c2d Fix tag push failure in build script 2025-09-06 05:06:03 -04:00
2 changed files with 90 additions and 9 deletions

View File

@@ -139,6 +139,13 @@ compile_project() {
print_warning "Clean failed or no Makefile found" print_warning "Clean failed or no Makefile found"
fi fi
# Force regenerate version.h to pick up new tags
if make force-version > /dev/null 2>&1; then
print_success "Regenerated version.h"
else
print_warning "Failed to regenerate version.h"
fi
# Compile the project # Compile the project
if make > /dev/null 2>&1; then if make > /dev/null 2>&1; then
print_success "C-Relay compiled successfully" print_success "C-Relay compiled successfully"
@@ -229,10 +236,65 @@ git_commit_and_push() {
exit 1 exit 1
fi fi
if git push --tags > /dev/null 2>&1; then # Push only the new tag to avoid conflicts with existing tags
print_success "Pushed tags" if git push origin "$NEW_VERSION" > /dev/null 2>&1; then
print_success "Pushed tag: $NEW_VERSION"
else else
print_warning "Failed to push tags" print_warning "Tag push failed, trying force push..."
if git push --force origin "$NEW_VERSION" > /dev/null 2>&1; then
print_success "Force-pushed updated tag: $NEW_VERSION"
else
print_error "Failed to push tag: $NEW_VERSION"
exit 1
fi
fi
}
# Function to commit and push changes without creating a tag (tag already created)
git_commit_and_push_no_tag() {
print_status "Preparing git commit..."
# Stage all changes
if git add . > /dev/null 2>&1; then
print_success "Staged all changes"
else
print_error "Failed to stage changes"
exit 1
fi
# Check if there are changes to commit
if git diff --staged --quiet; then
print_warning "No changes to commit"
else
# Commit changes
if git commit -m "$NEW_VERSION - $COMMIT_MESSAGE" > /dev/null 2>&1; then
print_success "Committed changes"
else
print_error "Failed to commit changes"
exit 1
fi
fi
# Push changes and tags
print_status "Pushing to remote repository..."
if git push > /dev/null 2>&1; then
print_success "Pushed changes"
else
print_error "Failed to push changes"
exit 1
fi
# Push only the new tag to avoid conflicts with existing tags
if git push origin "$NEW_VERSION" > /dev/null 2>&1; then
print_success "Pushed tag: $NEW_VERSION"
else
print_warning "Tag push failed, trying force push..."
if git push --force origin "$NEW_VERSION" > /dev/null 2>&1; then
print_success "Force-pushed updated tag: $NEW_VERSION"
else
print_error "Failed to push tag: $NEW_VERSION"
exit 1
fi
fi fi
} }
@@ -352,14 +414,23 @@ main() {
# Increment minor version for releases # Increment minor version for releases
increment_version "minor" increment_version "minor"
# Compile project first # Create new git tag BEFORE compilation so version.h picks it up
if git tag "$NEW_VERSION" > /dev/null 2>&1; then
print_success "Created tag: $NEW_VERSION"
else
print_warning "Tag $NEW_VERSION already exists, removing and recreating..."
git tag -d "$NEW_VERSION" > /dev/null 2>&1
git tag "$NEW_VERSION" > /dev/null 2>&1
fi
# Compile project first (will now pick up the new tag)
compile_project compile_project
# Build release binaries # Build release binaries
build_release_binaries build_release_binaries
# Commit and push # Commit and push (but skip tag creation since we already did it)
git_commit_and_push git_commit_and_push_no_tag
# Create Gitea release with binaries # Create Gitea release with binaries
create_gitea_release create_gitea_release
@@ -376,11 +447,20 @@ main() {
# Increment patch version for regular commits # Increment patch version for regular commits
increment_version "patch" increment_version "patch"
# Compile project # Create new git tag BEFORE compilation so version.h picks it up
if git tag "$NEW_VERSION" > /dev/null 2>&1; then
print_success "Created tag: $NEW_VERSION"
else
print_warning "Tag $NEW_VERSION already exists, removing and recreating..."
git tag -d "$NEW_VERSION" > /dev/null 2>&1
git tag "$NEW_VERSION" > /dev/null 2>&1
fi
# Compile project (will now pick up the new tag)
compile_project compile_project
# Commit and push # Commit and push (but skip tag creation since we already did it)
git_commit_and_push git_commit_and_push_no_tag
print_success "Build and push completed successfully!" print_success "Build and push completed successfully!"
print_status "Version $NEW_VERSION pushed to repository" print_status "Version $NEW_VERSION pushed to repository"

View File

@@ -25,6 +25,7 @@ extern void log_error(const char* message);
// ================================ // ================================
// CORE CONFIGURATION FUNCTIONS // CORE CONFIGURATION FUNCTIONS
// ================================ // ================================
//
int init_configuration_system(void) { int init_configuration_system(void) {
log_info("Initializing configuration system..."); log_info("Initializing configuration system...");