Gitignore build and deploy scripts

These contain local paths and shouldn't be tracked.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
njohnson 2026-01-11 16:13:03 -05:00
parent 6b19ebb217
commit 6fdcc44948
6 changed files with 7 additions and 539 deletions

7
.gitignore vendored
View File

@ -48,5 +48,12 @@ tools/steamcmd/
# Environment files (API keys)
.env
# Build and deploy scripts (local config)
build_debug.cmd
build_release.cmd
build_all_debug.sh
build_all_release.sh
deploy.sh
# Auto-generated LaTeX config
docs/appconfig.tex

View File

@ -1,9 +0,0 @@
#!/bin/bash
# Build XPlor in Debug mode
# This script calls the Windows batch file which sets up MSVC environment
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# Convert to Windows path and call batch file
cmd.exe //c "build_debug.cmd"

View File

@ -1,9 +0,0 @@
#!/bin/bash
# Build XPlor in Release mode
# This script calls the Windows batch file which sets up MSVC environment
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# Convert to Windows path and call batch file
cmd.exe //c "build_release.cmd"

View File

@ -1,63 +0,0 @@
@echo off
REM Build XPlor in Debug mode using jom (like Qt Creator)
setlocal
REM Setup Visual Studio environment
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
if errorlevel 1 (
echo ERROR: Could not setup MSVC environment
exit /b 1
)
REM Qt paths
set QT_PATH=C:\Qt\6.10.0\msvc2022_64
set JOM_PATH=C:\Qt\Tools\QtCreator\bin\jom
set PATH=%QT_PATH%\bin;%JOM_PATH%;%PATH%
REM Get script directory
set SCRIPT_DIR=%~dp0
cd /d "%SCRIPT_DIR%"
REM Build directory
set BUILD_DIR=build\Debug
if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
cd "%BUILD_DIR%"
echo.
echo === Running qmake ===
qmake.exe "%SCRIPT_DIR%XPlor.pro" -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug"
if errorlevel 1 (
echo ERROR: qmake failed
exit /b 1
)
echo.
echo === Building with jom ===
jom.exe
if errorlevel 1 (
echo ERROR: jom build failed
exit /b 1
)
echo.
echo === Installing ===
jom.exe install
if errorlevel 1 (
echo ERROR: jom install failed
exit /b 1
)
echo.
echo === Running windeployqt ===
cd app\debug
windeployqt6.exe app.exe
if errorlevel 1 (
echo ERROR: windeployqt failed
exit /b 1
)
echo.
echo ========================================
echo Debug build complete!
echo Output: %SCRIPT_DIR%%BUILD_DIR%\app\debug\app.exe
echo ========================================

View File

@ -1,63 +0,0 @@
@echo off
REM Build XPlor in Release mode using jom (like Qt Creator)
setlocal
REM Setup Visual Studio environment
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
if errorlevel 1 (
echo ERROR: Could not setup MSVC environment
exit /b 1
)
REM Qt paths
set QT_PATH=C:\Qt\6.10.0\msvc2022_64
set JOM_PATH=C:\Qt\Tools\QtCreator\bin\jom
set PATH=%QT_PATH%\bin;%JOM_PATH%;%PATH%
REM Get script directory
set SCRIPT_DIR=%~dp0
cd /d "%SCRIPT_DIR%"
REM Build directory
set BUILD_DIR=build\Release
if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
cd "%BUILD_DIR%"
echo.
echo === Running qmake ===
qmake.exe "%SCRIPT_DIR%XPlor.pro" -spec win32-msvc "CONFIG+=release"
if errorlevel 1 (
echo ERROR: qmake failed
exit /b 1
)
echo.
echo === Building with jom ===
jom.exe
if errorlevel 1 (
echo ERROR: jom build failed
exit /b 1
)
echo.
echo === Installing ===
jom.exe install
if errorlevel 1 (
echo ERROR: jom install failed
exit /b 1
)
echo.
echo === Running windeployqt ===
cd app\release
windeployqt6.exe --release app.exe
if errorlevel 1 (
echo ERROR: windeployqt failed
exit /b 1
)
echo.
echo ========================================
echo Release build complete!
echo Output: %SCRIPT_DIR%%BUILD_DIR%\app\release\app.exe
echo ========================================

395
deploy.sh
View File

@ -1,395 +0,0 @@
#!/bin/bash
# Deploy XPlor - Build, package, and release to Gitea
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
echo_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
echo_error() { echo -e "${RED}[ERROR]${NC} $1"; }
# =============================================================================
# Configuration
# =============================================================================
# Load .env file
if [ -f ".env" ]; then
echo_info "Loading configuration from .env..."
source .env
else
echo_error ".env file not found! Please create one with:"
echo " APP_NAME=XPlor"
echo " GITEA_ACCESS_TOKEN=your_token_here"
exit 1
fi
# Validate required variables
if [ -z "$APP_NAME" ]; then APP_NAME="XPlor"; fi
if [ -z "$GITEA_ACCESS_TOKEN" ]; then
echo_error "GITEA_ACCESS_TOKEN not set in .env"
exit 1
fi
# =============================================================================
# Auto-increment version from latest git tag
# =============================================================================
echo_info "Detecting version from git tags..."
# Get the latest tag (sorted by version number)
LATEST_TAG=$(git tag -l --sort=-v:refname | head -1 2>/dev/null || echo "")
if [ -z "$LATEST_TAG" ]; then
echo_warn "No existing tags found, starting at 1.0"
APP_VERSION="1.0"
else
echo_info "Latest tag: $LATEST_TAG"
# Parse version components (supports X.Y or X.Y.Z format)
if [[ "$LATEST_TAG" =~ ^([0-9]+)\.([0-9]+)(\.([0-9]+))?$ ]]; then
MAJOR="${BASH_REMATCH[1]}"
MINOR="${BASH_REMATCH[2]}"
PATCH="${BASH_REMATCH[4]}"
if [ -n "$PATCH" ]; then
# X.Y.Z format - increment patch
NEW_PATCH=$((PATCH + 1))
APP_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
else
# X.Y format - increment minor
NEW_MINOR=$((MINOR + 1))
APP_VERSION="$MAJOR.$NEW_MINOR"
fi
else
echo_error "Could not parse version from tag: $LATEST_TAG"
echo "Expected format: X.Y or X.Y.Z"
exit 1
fi
fi
echo_info "New version: $APP_VERSION"
# Update .env file with new version
if [ -f ".env" ]; then
if grep -q "^APP_VERSION=" .env; then
# Update existing APP_VERSION line
sed -i "s/^APP_VERSION=.*/APP_VERSION=$APP_VERSION/" .env
echo_info "Updated APP_VERSION in .env"
else
# Add APP_VERSION line
echo "APP_VERSION=$APP_VERSION" >> .env
echo_info "Added APP_VERSION to .env"
fi
fi
# Gitea configuration
GITEA_URL="https://code.redline.llc"
GITEA_API="$GITEA_URL/api/v1"
GITEA_REPO="repos/njohnson/XPlor"
# Qt paths
QT_PATH="/c/Qt/6.10.0/msvc2022_64"
export PATH="$QT_PATH/bin:$PATH"
# Build paths
BUILD_DIR="build/Release"
BUILD_OUTPUT="$BUILD_DIR/app/release"
RELEASE_DIR="releases/$APP_NAME-$APP_VERSION"
ZIP_NAME="$APP_NAME-$APP_VERSION.zip"
LIBS_ZIP_NAME="$APP_NAME-$APP_VERSION-libs.zip"
echo_info "Deploying $APP_NAME version $APP_VERSION"
# =============================================================================
# Step 1: Build Release
# =============================================================================
echo_info "Building release..."
if [ -f "./build_all_release.sh" ]; then
./build_all_release.sh
else
echo_error "build_all_release.sh not found!"
exit 1
fi
# Verify the built executable exists (windeployqt already ran)
EXE_PATH="$BUILD_OUTPUT/app.exe"
if [ ! -f "$EXE_PATH" ]; then
echo_error "Could not find built executable at: $EXE_PATH"
exit 1
fi
echo_info "Found executable: $EXE_PATH"
# =============================================================================
# Step 2: Create Release Directory
# =============================================================================
echo_info "Creating release directory..."
rm -rf "$RELEASE_DIR"
mkdir -p "$RELEASE_DIR"
# =============================================================================
# Step 3: Copy build output (already has windeployqt applied)
# =============================================================================
echo_info "Copying build output..."
DEPLOY_DIR="$RELEASE_DIR/deploy"
cp -r "$BUILD_OUTPUT" "$DEPLOY_DIR"
# Rename executable to versioned name
mv "$DEPLOY_DIR/app.exe" "$DEPLOY_DIR/$APP_NAME-$APP_VERSION.exe"
# =============================================================================
# Step 4: Ensure definitions folder is included
# =============================================================================
echo_info "Verifying definitions..."
if [ ! -d "$DEPLOY_DIR/definitions" ]; then
if [ -d "definitions" ]; then
cp -r definitions "$DEPLOY_DIR/"
else
echo_warn "definitions/ folder not found!"
fi
fi
# =============================================================================
# Step 5: Create ZIP archives
# =============================================================================
echo_info "Creating ZIP archives..."
cd "$RELEASE_DIR"
# Main archive with everything (exe + Qt libs + definitions)
echo_info "Creating main archive: $ZIP_NAME"
if command -v 7z &> /dev/null; then
7z a -tzip "$ZIP_NAME" "./deploy/*" -r
elif command -v zip &> /dev/null; then
cd deploy && zip -r "../$ZIP_NAME" . && cd ..
else
echo_error "No zip utility found (tried 7z, zip)"
exit 1
fi
# Libs archive (Qt libs only, no exe or definitions)
echo_info "Creating libs archive: $LIBS_ZIP_NAME"
cd deploy
if command -v 7z &> /dev/null; then
7z a -tzip "../$LIBS_ZIP_NAME" . -r \
-x!"$APP_NAME-$APP_VERSION.exe" \
-x!definitions
elif command -v zip &> /dev/null; then
zip -r "../$LIBS_ZIP_NAME" . \
-x "$APP_NAME-$APP_VERSION.exe" \
-x "definitions/*"
fi
cd ..
# Clean up deploy subdirectory (keep only ZIPs)
rm -rf deploy
echo_info "Created: $RELEASE_DIR/$ZIP_NAME"
echo_info "Created: $RELEASE_DIR/$LIBS_ZIP_NAME"
cd "$SCRIPT_DIR"
# =============================================================================
# Step 6: Generate Release Notes
# =============================================================================
echo_info "Generating release notes..."
# Use LATEST_TAG from version detection above
if [ -n "$LATEST_TAG" ]; then
echo_info "Generating changelog since $LATEST_TAG..."
CHANGELOG=$(git log --oneline "$LATEST_TAG..HEAD" 2>/dev/null || echo "Initial release")
else
echo_info "No previous tag found, using recent commits..."
CHANGELOG=$(git log --oneline -20 2>/dev/null || echo "Initial release")
fi
# Use Claude Code to generate release notes
echo_info "Calling Claude Code to generate release notes..."
CLAUDE_PROMPT="Generate release notes for $APP_NAME version $APP_VERSION.
Git commits since last release:
$CHANGELOG
Write a brief, professional release notes summary. Format as markdown with:
- A short summary paragraph (2-3 sentences) describing the main changes
- A bullet list of key changes (group related commits)
- Keep it concise, no more than 10 bullet points
Do NOT include installation instructions or download links.
Output ONLY the release notes content, no explanations."
# Call claude.exe with the prompt (--print outputs only the response)
CLAUDE_NOTES=$(echo "$CLAUDE_PROMPT" | claude.exe --print 2>/dev/null || echo "")
if [ -n "$CLAUDE_NOTES" ]; then
echo_info "Claude generated release notes successfully"
RELEASE_NOTES="$CLAUDE_NOTES
---
### Installation
1. Download \`$ZIP_NAME\`
2. Extract to desired location
3. Run \`$APP_NAME-$APP_VERSION.exe\`
"
else
echo_warn "Claude Code not available, using basic release notes"
RELEASE_NOTES="## $APP_NAME $APP_VERSION
### Changes
\`\`\`
$CHANGELOG
\`\`\`
### Installation
1. Download \`$ZIP_NAME\`
2. Extract to desired location
3. Run \`$APP_NAME-$APP_VERSION.exe\`
"
fi
echo_info "Release notes generated"
# =============================================================================
# Step 7: Confirm before publishing
# =============================================================================
echo ""
echo "========================================"
echo "Ready to publish release $APP_VERSION"
echo "========================================"
echo ""
echo "This will:"
echo " - Create git tag: $APP_VERSION"
echo " - Create Gitea release"
echo " - Upload: $ZIP_NAME"
echo " - Upload: $LIBS_ZIP_NAME"
echo ""
read -p "Proceed with publishing? [y/N] " -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo_warn "Aborted by user"
echo_info "Local files created in: $RELEASE_DIR/"
exit 0
fi
# =============================================================================
# Step 8: Create Git Tag (local)
# =============================================================================
echo_info "Creating git tag $APP_VERSION..."
if git tag -l | grep -q "^$APP_VERSION$"; then
echo_warn "Tag $APP_VERSION already exists locally"
else
git tag -a "$APP_VERSION" -m "Release $APP_VERSION"
echo_info "Tag created locally"
fi
# =============================================================================
# Step 9: Create Gitea Release
# =============================================================================
echo_info "Creating Gitea release..."
# Check if release already exists
EXISTING_RELEASE=$(curl -s -H "Authorization: token $GITEA_ACCESS_TOKEN" \
"$GITEA_API/$GITEA_REPO/releases/tags/$APP_VERSION" 2>/dev/null || echo "{}")
if echo "$EXISTING_RELEASE" | grep -q '"id"'; then
echo_warn "Release $APP_VERSION already exists on Gitea"
RELEASE_ID=$(echo "$EXISTING_RELEASE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
else
# Escape release notes for JSON
ESCAPED_NOTES=$(echo "$RELEASE_NOTES" | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/"/\\"/g')
# Create release
RELEASE_RESPONSE=$(curl -s -X POST "$GITEA_API/$GITEA_REPO/releases" \
-H "Authorization: token $GITEA_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d "{
\"tag_name\": \"$APP_VERSION\",
\"name\": \"Release $APP_VERSION\",
\"body\": \"$ESCAPED_NOTES\",
\"prerelease\": true
}")
if echo "$RELEASE_RESPONSE" | grep -q '"id"'; then
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
echo_info "Release created with ID: $RELEASE_ID"
else
echo_error "Failed to create release:"
echo "$RELEASE_RESPONSE"
exit 1
fi
fi
# =============================================================================
# Step 10: Upload Assets
# =============================================================================
echo_info "Uploading assets..."
# Upload main ZIP
ZIP_PATH="$RELEASE_DIR/$ZIP_NAME"
if [ -f "$ZIP_PATH" ]; then
echo_info "Uploading $ZIP_NAME..."
UPLOAD_RESPONSE=$(curl -s -X POST \
"$GITEA_API/$GITEA_REPO/releases/$RELEASE_ID/assets?name=$ZIP_NAME" \
-H "Authorization: token $GITEA_ACCESS_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary "@$ZIP_PATH")
if echo "$UPLOAD_RESPONSE" | grep -q '"id"'; then
echo_info "Main ZIP uploaded successfully"
else
echo_warn "Main ZIP upload may have failed:"
echo "$UPLOAD_RESPONSE"
fi
else
echo_error "ZIP file not found: $ZIP_PATH"
fi
# Upload libs ZIP
LIBS_ZIP_PATH="$RELEASE_DIR/$LIBS_ZIP_NAME"
if [ -f "$LIBS_ZIP_PATH" ]; then
echo_info "Uploading $LIBS_ZIP_NAME..."
UPLOAD_RESPONSE=$(curl -s -X POST \
"$GITEA_API/$GITEA_REPO/releases/$RELEASE_ID/assets?name=$LIBS_ZIP_NAME" \
-H "Authorization: token $GITEA_ACCESS_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary "@$LIBS_ZIP_PATH")
if echo "$UPLOAD_RESPONSE" | grep -q '"id"'; then
echo_info "Libs ZIP uploaded successfully"
else
echo_warn "Libs ZIP upload may have failed:"
echo "$UPLOAD_RESPONSE"
fi
else
echo_warn "Libs ZIP not found: $LIBS_ZIP_PATH"
fi
# =============================================================================
# Done
# =============================================================================
echo ""
echo_info "Deployment complete!"
echo_info "Release URL: $GITEA_URL/njohnson/XPlor/releases/tag/$APP_VERSION"
echo ""
echo "Files created:"
echo " - $RELEASE_DIR/$ZIP_NAME"
echo " - $RELEASE_DIR/$LIBS_ZIP_NAME"
echo ""