Compare commits
5 Commits
v40
...
v2025.0625
Author | SHA1 | Date | |
---|---|---|---|
54af706032 | |||
ef7470dcce | |||
d18f875c0e | |||
6f525b4f6c | |||
ed13bdb5b5 |
@ -5,7 +5,8 @@ if(NOT DEFINED PROJECT_NAME)
|
||||
message(FATAL_ERROR "PROJECT_NAME is not defined. Pass it via -DPROJECT_NAME=<name>")
|
||||
endif()
|
||||
|
||||
project(${PROJECT_NAME})
|
||||
string(TIMESTAMP PROJECT_VERSION "%Y.%m%d.%H%M")
|
||||
project(${PROJECT_NAME} VERSION ${PROJECT_VERSION} LANGUAGES CXX)
|
||||
|
||||
# Build configuration
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
@ -21,6 +22,8 @@ add_executable(${PROJECT_NAME}
|
||||
src/b64ed.cpp
|
||||
)
|
||||
|
||||
# Configure version.hpp
|
||||
configure_file("src/version.hpp.in" "src/autogen/version.hpp" @ONLY)
|
||||
|
||||
# Include directories
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||
|
@ -12,19 +12,10 @@ if [ "$ARCH" = "aarch64" ]; then
|
||||
ARCH_ALIAS="arm64"
|
||||
fi
|
||||
|
||||
# Increment version
|
||||
VERSION_FILE="${SCRIPT_DIR}/src/version.h"
|
||||
if [ ! -f "${VERSION_FILE}" ]; then
|
||||
echo "${VERSION_FILE} not found!" >&2
|
||||
exit 1
|
||||
else
|
||||
v=$(cat "${VERSION_FILE}" | grep -o 'static const char \*VERSION = "[0-9.]*";' | cut -d'"' -f2)
|
||||
oldv=$v
|
||||
v=$((v+1))
|
||||
echo "Incrementing version from $oldv to $v" >&2
|
||||
echo "static const char *VERSION = \"$v\";" > "${VERSION_FILE}"
|
||||
fi
|
||||
TAG="v$v"
|
||||
# Get version from CMake timestamp
|
||||
VERSION=$(date +"%Y.%m%d.%H%M")
|
||||
TAG="v$VERSION"
|
||||
echo "Building version $VERSION" >&2
|
||||
|
||||
# build release version
|
||||
export CMAKE_BUILD_TYPE="Release"
|
||||
@ -77,6 +68,30 @@ if [ -z "$RELEASE_WRITE_TOKEN" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create and push git tag
|
||||
echo "Creating git tag $TAG..."
|
||||
|
||||
# Configure git identity if not set (for CI environments)
|
||||
if ! git config user.email >/dev/null 2>&1; then
|
||||
git config user.email "ci@gitea.jde.nz"
|
||||
git config user.name "CI Bot"
|
||||
fi
|
||||
|
||||
# Check if tag already exists
|
||||
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||
echo "Tag $TAG already exists, deleting it first..."
|
||||
git tag -d "$TAG"
|
||||
git push origin --delete "$TAG" || true
|
||||
fi
|
||||
|
||||
git tag -a "$TAG" -m "Release $TAG"
|
||||
if ! git push origin "$TAG"; then
|
||||
echo "Failed to push tag $TAG to origin" >&2
|
||||
# Try to delete local tag if push failed
|
||||
git tag -d "$TAG"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Creating release $TAG on Gitea..."
|
||||
RELEASE_RESPONSE=$(curl -s -X POST "$API_URL/releases" \
|
||||
-H "Content-Type: application/json" \
|
||||
@ -125,7 +140,7 @@ for FILE in ${PROJECT}.${ARCH_ALIAS} ${PROJECT}.${ARCH} install.sh; do
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Published bb64 version $v to $REPO_URL (tag $TAG) with binaries for $ARCH_ALIAS / $ARCH."
|
||||
echo "Published bb64 version $VERSION to $REPO_URL (tag $TAG) with binaries for $ARCH_ALIAS / $ARCH."
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <filesystem>
|
||||
#include "version.h"
|
||||
#include "version.hpp"
|
||||
#include "b64ed.hpp"
|
||||
|
||||
// Recursively decode and print if nested bb64 command is found
|
||||
|
@ -1 +0,0 @@
|
||||
static const char *VERSION = "39";
|
1
bb64/src/version.hpp.in
Normal file
1
bb64/src/version.hpp.in
Normal file
@ -0,0 +1 @@
|
||||
static const char *VERSION = "@PROJECT_VERSION@";
|
@ -2,6 +2,12 @@
|
||||
set -uo pipefail # Remove -e to handle errors manually
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Arrays to track results
|
||||
declare -A BUILD_RESULTS
|
||||
declare -A TEST_RESULTS
|
||||
@ -166,9 +172,36 @@ function print_summary() {
|
||||
local test_status="${TEST_RESULTS[$project]:-'-'}"
|
||||
local publish_status="${PUBLISH_RESULTS[$project]:-'-'}"
|
||||
|
||||
printf "│ %-*s │ %-7s │ %-7s │ %-7s │\n" \
|
||||
# Format status with proper spacing and colors for Unicode characters
|
||||
local build_col test_col publish_col
|
||||
|
||||
# Format build status
|
||||
case "$build_status" in
|
||||
"✓") build_col=" ${GREEN}✓${NC} " ;;
|
||||
"✗") build_col=" ${RED}✗${NC} " ;;
|
||||
"SKIP") build_col=" ${YELLOW}-${NC} " ;;
|
||||
*) build_col=" - " ;;
|
||||
esac
|
||||
|
||||
# Format test status
|
||||
case "$test_status" in
|
||||
"✓") test_col=" ${GREEN}✓${NC} " ;;
|
||||
"✗") test_col=" ${RED}✗${NC} " ;;
|
||||
"SKIP") test_col=" ${YELLOW}-${NC} " ;;
|
||||
*) test_col=" - " ;;
|
||||
esac
|
||||
|
||||
# Format publish status
|
||||
case "$publish_status" in
|
||||
"✓") publish_col=" ${GREEN}✓${NC} " ;;
|
||||
"✗") publish_col=" ${RED}✗${NC} " ;;
|
||||
"SKIP") publish_col=" ${YELLOW}-${NC} " ;;
|
||||
*) publish_col=" - " ;;
|
||||
esac
|
||||
|
||||
printf "│ %-*s │%b│%b│%b│\n" \
|
||||
$max_project_width "$project" \
|
||||
"$build_status" "$test_status" "$publish_status"
|
||||
"$build_col" "$test_col" "$publish_col"
|
||||
done
|
||||
|
||||
# Print bottom border
|
||||
|
@ -17,12 +17,19 @@ Examples:
|
||||
dehydrate src/ output/ Creates _src.cpp and _src.hpp in output/
|
||||
dehydrate -u Updates dehydrate to the latest version
|
||||
dehydrate -v Shows version number
|
||||
dehydrate version Shows version number
|
||||
)";
|
||||
|
||||
Args parse_args(int argc, char* argv[]) {
|
||||
Args args;
|
||||
int idx = 1;
|
||||
|
||||
// Check for "version" as first argument (no dash)
|
||||
if (argc > 1 && std::string(argv[1]) == "version") {
|
||||
args.version = true;
|
||||
return args;
|
||||
}
|
||||
|
||||
// Parse flags
|
||||
while (idx < argc && argv[idx][0] == '-') {
|
||||
std::string flag = argv[idx];
|
||||
|
Reference in New Issue
Block a user