diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e4fb3c..228370b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.1.1.4 (2025-08-28) +- **NEW**: Automated release creation script (`scripts/create_release.ps1`) +- **NEW**: Build scripts moved to `scripts/` directory for better organization +- **IMPROVED**: Enhanced build documentation with platform-specific instructions +- **IMPROVED**: Better project structure and organization + ## v0.1.1.3 (2025-08-28) ### New Features diff --git a/README.md b/README.md index b514672..a2cb1d6 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ A C++ library for interacting with PrivateBin servers via the JSON API v1.3. - **End-to-End Encryption**: Client-side encryption with AES-256-GCM - **Cross-Platform**: Support for Windows and Linux - **Complete API**: Implementation of all PrivateBin v1.3 API functions +- **Automated Builds**: Platform-specific build scripts for easy compilation ## File Upload Functionality @@ -56,6 +57,57 @@ int upload_file(const char* server_url, const char* file_path, 5. **Upload**: Encrypted data is sent to the PrivateBin server 6. **URL Generation**: The URL is created with the Base58-encoded key +## Build Scripts + +The project includes several build scripts in the `scripts/` directory for different platforms and use cases. + +### Windows Build Scripts + +#### PowerShell Build (Recommended) +**File:** `scripts/build_windows.ps1` +**Requirements:** PowerShell, Visual Studio 2022 Build Tools (C++), vcpkg (will be bootstrapped), Git + +```powershell +# Run from project root +powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\build_windows.ps1 +``` + +This script: +- Automatically bootstraps vcpkg if not present +- Configures CMake with Visual Studio 2022 generator +- Builds the project in Release configuration +- Creates a Windows distribution package with all artifacts + +#### Command Line Build +**File:** `scripts/build_thinkpad.bat` +**Requirements:** Visual Studio 2022 Build Tools/Community with C++ workload, vcpkg + +```cmd +# Run from project root +scripts\build_thinkpad.bat +``` + +This script: +- Automatically detects and initializes Visual Studio environment +- Handles vcpkg bootstrapping +- Configures CMake with proper toolchain +- Builds the project using MSVC compiler + +### Linux/macOS Build Script +**File:** `scripts/build.sh` +**Requirements:** CMake, C++17 compiler, vcpkg + +```bash +# Make executable and run from project root +chmod +x scripts/build.sh +./scripts/build.sh +``` + +This script: +- Bootstraps vcpkg if not present +- Configures CMake with Unix Makefiles +- Builds the project in Release configuration + ## Installation ### Dependencies @@ -67,6 +119,26 @@ int upload_file(const char* server_url, const char* file_path, ### Compilation +#### Windows (PowerShell) - Build via scripts/build_windows.ps1 +```powershell +# Requires: PowerShell, Visual Studio 2022 Build Tools (C++), vcpkg (will be bootstrapped), Git +powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\build_windows.ps1 +``` + +#### Windows (Command Line) - Build via scripts/build_thinkpad.bat +```cmd +# Requires: Visual Studio 2022 Build Tools/Community with C++ workload, vcpkg +scripts\build_thinkpad.bat +``` + +#### Linux/macOS - Build via scripts/build.sh +```bash +# Requires: CMake, C++17 compiler, vcpkg +chmod +x scripts/build.sh +./scripts/build.sh +``` + +#### Manual Build ```bash mkdir build cd build @@ -74,6 +146,8 @@ cmake .. cmake --build . --config Release ``` +**Note:** The manual build method requires you to have all dependencies (CMake, compiler, vcpkg) properly configured. For most users, the platform-specific build scripts are recommended. + ## Usage ### Simple Text Paste @@ -207,6 +281,12 @@ See [LICENSE](LICENSE) for details. ## Changelog +### v0.1.1.4 (2025-08-28) +- **NEW**: Automated release creation script (`scripts/create_release.ps1`) +- **NEW**: Build scripts moved to `scripts/` directory for better organization +- **IMPROVED**: Enhanced build documentation with platform-specific instructions +- **IMPROVED**: Better project structure and organization + ### v0.1.1.1 (2025-08-28) - **NEW**: Combined example program with both text and file upload functionality - **IMPROVED**: Unified command-line interface for examples diff --git a/build.bat b/build.bat deleted file mode 100644 index 8576a78..0000000 --- a/build.bat +++ /dev/null @@ -1,20 +0,0 @@ -@echo off -echo Building PrivateBin API C++ DLL... - -REM Create build directory -if not exist "build" mkdir build -cd build - -REM Generate build files with CMake and vcpkg manifest -cmake .. -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake - -REM Build the project -cmake --build . --config Release - -if %ERRORLEVEL% EQU 0 ( - echo Build completed successfully! -) else ( - echo Build failed with error level %ERRORLEVEL% -) - -cd .. \ No newline at end of file diff --git a/build.sh b/scripts/build.sh similarity index 100% rename from build.sh rename to scripts/build.sh diff --git a/build_thinkpad.bat b/scripts/build_thinkpad.bat similarity index 100% rename from build_thinkpad.bat rename to scripts/build_thinkpad.bat diff --git a/build_windows.ps1 b/scripts/build_windows.ps1 similarity index 100% rename from build_windows.ps1 rename to scripts/build_windows.ps1 diff --git a/scripts/collect_binaries.ps1 b/scripts/collect_binaries.ps1 index 8dffafb..5d23ccb 100644 --- a/scripts/collect_binaries.ps1 +++ b/scripts/collect_binaries.ps1 @@ -30,3 +30,4 @@ Get-ChildItem -LiteralPath $OutDir -File | Format-Table Name,Length -AutoSize + diff --git a/scripts/create_release.ps1 b/scripts/create_release.ps1 new file mode 100644 index 0000000..3e7311b --- /dev/null +++ b/scripts/create_release.ps1 @@ -0,0 +1,95 @@ +param( + [Parameter(Mandatory=$false)] + [string]$Token, + + [Parameter(Mandatory=$false)] + [switch]$Build +) + +# Token aus Umgebungsvariable laden falls nicht als Parameter übergeben +if (-not $Token) { + $Token = $env:GITEA_TOKEN + if (-not $Token) { + Write-Host "Fehler: Kein Token angegeben und GITEA_TOKEN Umgebungsvariable nicht gesetzt!" -ForegroundColor Red + Write-Host "Verwendung: .\create_release.ps1 -Token 'your_token' oder setze GITEA_TOKEN Umgebungsvariable" -ForegroundColor Yellow + exit 1 + } + Write-Host "Token aus Umgebungsvariable GITEA_TOKEN geladen" -ForegroundColor Green +} + +Write-Host "=== lib-privatebin Release Creator ===" -ForegroundColor Cyan + +# Aktuelle Version ermitteln +$lastTag = git describe --tags --abbrev=0 2>$null +if (-not $lastTag) { + $lastTag = "v0.1.0" +} + +Write-Host "Letzter Tag: $lastTag" -ForegroundColor Green + +# Version parsen +if ($lastTag -match "^v(\d+)\.(\d+)\.(\d+)(.*)$") { + $major = [int]$matches[1] + $minor = [int]$matches[2] + $patch = [int]$matches[3] + $suffix = $matches[4] + + $newPatch = $patch + 1 + $newVersion = "v$major.$minor.$newPatch$suffix" + + Write-Host "Neue Version: $newVersion" -ForegroundColor Green +} else { + Write-Host "Fehler: Ungültiges Versionsformat: $lastTag" -ForegroundColor Red + exit 1 +} + +# Build falls gewünscht +if ($Build) { + Write-Host "Führe Build durch..." -ForegroundColor Yellow + if (Test-Path "scripts\build_thinkpad.bat") { + Write-Host "Verwende scripts\build_thinkpad.bat..." -ForegroundColor Yellow + cmd /c scripts\build_thinkpad.bat + } else { + Write-Host "Verwende scripts\build_windows.ps1..." -ForegroundColor Yellow + powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\build_windows.ps1 + } + if ($LASTEXITCODE -ne 0) { + Write-Host "Build fehlgeschlagen!" -ForegroundColor Red + exit 1 + } +} + +# Änderungen committen +$status = git status --porcelain +if ($status) { + git add -A + git commit -m "Release $newVersion prepare for release" + git push origin HEAD +} + +# Tag erstellen und pushen +git tag -a $newVersion -m "Release $newVersion" +git push origin $newVersion + +# Release erstellen +$releaseBody = "## What is New in $newVersion`n`n- AUTOMATED: Release created by script`n- VERSION: Bumped from $lastTag to $newVersion`n`n## Build Artifacts`n`n- privatebinapi.dll - Windows Dynamic Link Library`n- privatebinapi.lib - Windows Import Library`n- example.exe - Combined example program`n- privatebinapi.h - C++ header file" + +$releaseData = @{ + tag_name = $newVersion + name = "$newVersion - Automated Release" + body = $releaseBody + draft = $false + prerelease = $false +} | ConvertTo-Json -Depth 10 + +$headers = @{ + "Authorization" = "token $Token" + "Content-Type" = "application/json" +} + +$releaseUri = "https://gitea.medisoftware.org/api/v1/repos/Markus/lib-privatebin/releases" +$release = Invoke-RestMethod -Uri $releaseUri -Method Post -Headers $headers -Body $releaseData + +Write-Host "Release erstellt: $($release.id)" -ForegroundColor Green +Write-Host "URL: $($release.html_url)" -ForegroundColor Green + diff --git a/scripts/gen_checksums.ps1 b/scripts/gen_checksums.ps1 index 8611ef6..6678163 100644 --- a/scripts/gen_checksums.ps1 +++ b/scripts/gen_checksums.ps1 @@ -35,3 +35,4 @@ Get-ChildItem -LiteralPath $BinDir -File | ForEach-Object { + diff --git a/scripts/gitea_upload.ps1 b/scripts/gitea_upload.ps1 index 6af2684..4a22b76 100644 --- a/scripts/gitea_upload.ps1 +++ b/scripts/gitea_upload.ps1 @@ -43,3 +43,4 @@ if ($resp.StatusCode -ge 200 -and $resp.StatusCode -lt 300) { + diff --git a/scripts/gitea_upload_all.ps1 b/scripts/gitea_upload_all.ps1 index a9c56cd..742b88e 100644 --- a/scripts/gitea_upload_all.ps1 +++ b/scripts/gitea_upload_all.ps1 @@ -45,3 +45,4 @@ foreach ($f in $files) { + diff --git a/scripts/prune_release_assets.ps1 b/scripts/prune_release_assets.ps1 index f33344b..5dd6b69 100644 --- a/scripts/prune_release_assets.ps1 +++ b/scripts/prune_release_assets.ps1 @@ -76,3 +76,4 @@ Write-Host 'Release notes updated with links.' +