v0.1.5 - Make versioning system
This commit is contained in:
@@ -131,21 +131,48 @@ increment_version() {
|
|||||||
export NEW_VERSION
|
export NEW_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to update version in header file
|
||||||
|
update_version_in_header() {
|
||||||
|
local version="$1"
|
||||||
|
print_status "Updating version in src/ginxsom.h to $version..."
|
||||||
|
|
||||||
|
# Extract version components (remove 'v' prefix)
|
||||||
|
local version_no_v=${version#v}
|
||||||
|
|
||||||
|
# Parse major.minor.patch using regex
|
||||||
|
if [[ $version_no_v =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
|
||||||
|
local major=${BASH_REMATCH[1]}
|
||||||
|
local minor=${BASH_REMATCH[2]}
|
||||||
|
local patch=${BASH_REMATCH[3]}
|
||||||
|
|
||||||
|
# Update the header file
|
||||||
|
sed -i "s/#define VERSION_MAJOR [0-9]\+/#define VERSION_MAJOR $major/" src/ginxsom.h
|
||||||
|
sed -i "s/#define VERSION_MINOR [0-9]\+/#define VERSION_MINOR $minor/" src/ginxsom.h
|
||||||
|
sed -i "s/#define VERSION_PATCH [0-9]\+/#define VERSION_PATCH $patch/" src/ginxsom.h
|
||||||
|
sed -i "s/#define VERSION \"v[0-9]\+\.[0-9]\+\.[0-9]\+\"/#define VERSION \"$version\"/" src/ginxsom.h
|
||||||
|
|
||||||
|
print_success "Updated version in header file"
|
||||||
|
else
|
||||||
|
print_error "Invalid version format: $version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to compile the Ginxsom project
|
# Function to compile the Ginxsom project
|
||||||
compile_project() {
|
compile_project() {
|
||||||
print_status "Compiling Ginxsom FastCGI server..."
|
print_status "Compiling Ginxsom FastCGI server..."
|
||||||
|
|
||||||
# Clean previous build
|
# Clean previous build
|
||||||
if make clean > /dev/null 2>&1; then
|
if make clean > /dev/null 2>&1; then
|
||||||
print_success "Cleaned previous build"
|
print_success "Cleaned previous build"
|
||||||
else
|
else
|
||||||
print_warning "Clean failed or no Makefile found"
|
print_warning "Clean failed or no Makefile found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Compile the project
|
# Compile the project
|
||||||
if make > /dev/null 2>&1; then
|
if make > /dev/null 2>&1; then
|
||||||
print_success "Ginxsom compiled successfully"
|
print_success "Ginxsom compiled successfully"
|
||||||
|
|
||||||
# Verify the binary was created
|
# Verify the binary was created
|
||||||
if [[ -f "build/ginxsom-fcgi" ]]; then
|
if [[ -f "build/ginxsom-fcgi" ]]; then
|
||||||
print_success "Binary created: build/ginxsom-fcgi"
|
print_success "Binary created: build/ginxsom-fcgi"
|
||||||
@@ -390,9 +417,12 @@ main() {
|
|||||||
git tag "$NEW_VERSION" > /dev/null 2>&1
|
git tag "$NEW_VERSION" > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Update version in header file
|
||||||
|
update_version_in_header "$NEW_VERSION"
|
||||||
|
|
||||||
# Compile project
|
# Compile project
|
||||||
compile_project
|
compile_project
|
||||||
|
|
||||||
# Build release binary
|
# Build release binary
|
||||||
build_release_binary
|
build_release_binary
|
||||||
|
|
||||||
@@ -423,9 +453,12 @@ main() {
|
|||||||
git tag "$NEW_VERSION" > /dev/null 2>&1
|
git tag "$NEW_VERSION" > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Update version in header file
|
||||||
|
update_version_in_header "$NEW_VERSION"
|
||||||
|
|
||||||
# Compile project
|
# Compile project
|
||||||
compile_project
|
compile_project
|
||||||
|
|
||||||
# Commit and push (but skip tag creation since we already did it)
|
# Commit and push (but skip tag creation since we already did it)
|
||||||
git_commit_and_push_no_tag
|
git_commit_and_push_no_tag
|
||||||
|
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ http {
|
|||||||
|
|
||||||
# Root redirect - Server info endpoint
|
# Root redirect - Server info endpoint
|
||||||
location = / {
|
location = / {
|
||||||
return 200 '{\n "server": "ginxsom",\n "version": "1.0.0",\n "description": "Ginxsom Blossom Server",\n "endpoints": {\n "blob_get": "GET /<sha256>",\n "blob_head": "HEAD /<sha256>",\n "upload": "PUT /upload",\n "upload_requirements": "HEAD /upload",\n "list": "GET /list/<pubkey>",\n "delete": "DELETE /<sha256>",\n "mirror": "PUT /mirror",\n "report": "PUT /report",\n "health": "GET /health"\n },\n "supported_buds": [\n "BUD-01",\n "BUD-02",\n "BUD-04",\n "BUD-06",\n "BUD-08",\n "BUD-09"\n ],\n "limits": {\n "max_upload_size": 104857600,\n "supported_mime_types": [\n "image/jpeg",\n "image/png",\n "image/webp",\n "image/gif",\n "video/mp4",\n "video/webm",\n "audio/mpeg",\n "audio/ogg",\n "text/plain",\n "application/pdf"\n ]\n },\n "authentication": {\n "required_for_upload": false,\n "required_for_delete": true,\n "required_for_list": false,\n "nip42_enabled": true\n }\n}';
|
return 200 '{\n "server": "ginxsom",\n "version": "v0.1.4",\n "description": "Ginxsom Blossom Server",\n "endpoints": {\n "blob_get": "GET /<sha256>",\n "blob_head": "HEAD /<sha256>",\n "upload": "PUT /upload",\n "upload_requirements": "HEAD /upload",\n "list": "GET /list/<pubkey>",\n "delete": "DELETE /<sha256>",\n "mirror": "PUT /mirror",\n "report": "PUT /report",\n "health": "GET /health"\n },\n "supported_buds": [\n "BUD-01",\n "BUD-02",\n "BUD-04",\n "BUD-06",\n "BUD-08",\n "BUD-09"\n ],\n "limits": {\n "max_upload_size": 104857600,\n "supported_mime_types": [\n "image/jpeg",\n "image/png",\n "image/webp",\n "image/gif",\n "video/mp4",\n "video/webm",\n "audio/mpeg",\n "audio/ogg",\n "text/plain",\n "application/pdf"\n ]\n },\n "authentication": {\n "required_for_upload": false,\n "required_for_delete": true,\n "required_for_list": false,\n "nip42_enabled": true\n }\n}';
|
||||||
add_header Content-Type application/json;
|
add_header Content-Type application/json;
|
||||||
add_header Access-Control-Allow-Origin * always;
|
add_header Access-Control-Allow-Origin * always;
|
||||||
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH" always;
|
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH" always;
|
||||||
@@ -685,7 +685,7 @@ http {
|
|||||||
|
|
||||||
# Root redirect - Server info endpoint
|
# Root redirect - Server info endpoint
|
||||||
location = / {
|
location = / {
|
||||||
return 200 '{\n "server": "ginxsom",\n "version": "1.0.0",\n "description": "Ginxsom Blossom Server (HTTPS)",\n "endpoints": {\n "blob_get": "GET /<sha256>",\n "blob_head": "HEAD /<sha256>",\n "upload": "PUT /upload",\n "upload_requirements": "HEAD /upload",\n "list": "GET /list/<pubkey>",\n "delete": "DELETE /<sha256>",\n "mirror": "PUT /mirror",\n "report": "PUT /report",\n "health": "GET /health"\n },\n "supported_buds": [\n "BUD-01",\n "BUD-02",\n "BUD-04",\n "BUD-06",\n "BUD-08",\n "BUD-09"\n ],\n "limits": {\n "max_upload_size": 104857600,\n "supported_mime_types": [\n "image/jpeg",\n "image/png",\n "image/webp",\n "image/gif",\n "video/mp4",\n "video/webm",\n "audio/mpeg",\n "audio/ogg",\n "text/plain",\n "application/pdf"\n ]\n },\n "authentication": {\n "required_for_upload": false,\n "required_for_delete": true,\n "required_for_list": false,\n "nip42_enabled": true\n }\n}';
|
return 200 '{\n "server": "ginxsom",\n "version": "v0.1.4",\n "description": "Ginxsom Blossom Server (HTTPS)",\n "endpoints": {\n "blob_get": "GET /<sha256>",\n "blob_head": "HEAD /<sha256>",\n "upload": "PUT /upload",\n "upload_requirements": "HEAD /upload",\n "list": "GET /list/<pubkey>",\n "delete": "DELETE /<sha256>",\n "mirror": "PUT /mirror",\n "report": "PUT /report",\n "health": "GET /health"\n },\n "supported_buds": [\n "BUD-01",\n "BUD-02",\n "BUD-04",\n "BUD-06",\n "BUD-08",\n "BUD-09"\n ],\n "limits": {\n "max_upload_size": 104857600,\n "supported_mime_types": [\n "image/jpeg",\n "image/png",\n "image/webp",\n "image/gif",\n "video/mp4",\n "video/webm",\n "audio/mpeg",\n "audio/ogg",\n "text/plain",\n "application/pdf"\n ]\n },\n "authentication": {\n "required_for_upload": false,\n "required_for_delete": true,\n "required_for_list": false,\n "nip42_enabled": true\n }\n}';
|
||||||
add_header Content-Type application/json;
|
add_header Content-Type application/json;
|
||||||
add_header Access-Control-Allow-Origin * always;
|
add_header Access-Control-Allow-Origin * always;
|
||||||
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH" always;
|
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH" always;
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ server {
|
|||||||
|
|
||||||
# Default location - Server info endpoint
|
# Default location - Server info endpoint
|
||||||
location / {
|
location / {
|
||||||
return 200 '{\n "server": "ginxsom",\n "version": "1.0.0",\n "description": "Ginxsom Blossom Server",\n "endpoints": {\n "blob_get": "GET /<sha256>",\n "blob_head": "HEAD /<sha256>",\n "upload": "PUT /upload",\n "upload_requirements": "HEAD /upload",\n "list": "GET /list/<pubkey>",\n "delete": "DELETE /<sha256>",\n "mirror": "PUT /mirror",\n "report": "PUT /report",\n "health": "GET /health"\n },\n "supported_buds": [\n "BUD-01",\n "BUD-02",\n "BUD-04",\n "BUD-06",\n "BUD-08",\n "BUD-09"\n ],\n "limits": {\n "max_upload_size": 104857600,\n "supported_mime_types": [\n "image/jpeg",\n "image/png",\n "image/webp",\n "image/gif",\n "video/mp4",\n "video/webm",\n "audio/mpeg",\n "audio/ogg",\n "text/plain",\n "application/pdf"\n ]\n },\n "authentication": {\n "required_for_upload": false,\n "required_for_delete": true,\n "required_for_list": false,\n "nip42_enabled": true\n }\n}';
|
return 200 '{\n "server": "ginxsom",\n "version": "v0.1.4",\n "description": "Ginxsom Blossom Server",\n "endpoints": {\n "blob_get": "GET /<sha256>",\n "blob_head": "HEAD /<sha256>",\n "upload": "PUT /upload",\n "upload_requirements": "HEAD /upload",\n "list": "GET /list/<pubkey>",\n "delete": "DELETE /<sha256>",\n "mirror": "PUT /mirror",\n "report": "PUT /report",\n "health": "GET /health"\n },\n "supported_buds": [\n "BUD-01",\n "BUD-02",\n "BUD-04",\n "BUD-06",\n "BUD-08",\n "BUD-09"\n ],\n "limits": {\n "max_upload_size": 104857600,\n "supported_mime_types": [\n "image/jpeg",\n "image/png",\n "image/webp",\n "image/gif",\n "video/mp4",\n "video/webm",\n "audio/mpeg",\n "audio/ogg",\n "text/plain",\n "application/pdf"\n ]\n },\n "authentication": {\n "required_for_upload": false,\n "required_for_delete": true,\n "required_for_list": false,\n "nip42_enabled": true\n }\n}';
|
||||||
add_header Content-Type application/json;
|
add_header Content-Type application/json;
|
||||||
add_header Access-Control-Allow-Origin * always;
|
add_header Access-Control-Allow-Origin * always;
|
||||||
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH" always;
|
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH" always;
|
||||||
|
|||||||
@@ -7,6 +7,11 @@
|
|||||||
|
|
||||||
#ifndef GINXSOM_H
|
#ifndef GINXSOM_H
|
||||||
#define GINXSOM_H
|
#define GINXSOM_H
|
||||||
|
// Version information (auto-updated by build system)
|
||||||
|
#define VERSION_MAJOR 0
|
||||||
|
#define VERSION_MINOR 1
|
||||||
|
#define VERSION_PATCH 5
|
||||||
|
#define VERSION "v0.1.5"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user