v0.1.1.4: Build scripts moved to scripts/ directory; enhanced documentation; automated release script

This commit is contained in:
mbusc
2025-08-28 20:11:27 +02:00
parent 5528096614
commit 3c2c2b35e2
12 changed files with 186 additions and 20 deletions

View File

@ -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

View File

@ -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

View File

@ -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 ..

View File

@ -30,3 +30,4 @@ Get-ChildItem -LiteralPath $OutDir -File | Format-Table Name,Length -AutoSize

View File

@ -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

View File

@ -35,3 +35,4 @@ Get-ChildItem -LiteralPath $BinDir -File | ForEach-Object {

View File

@ -43,3 +43,4 @@ if ($resp.StatusCode -ge 200 -and $resp.StatusCode -lt 300) {

View File

@ -45,3 +45,4 @@ foreach ($f in $files) {

View File

@ -76,3 +76,4 @@ Write-Host 'Release notes updated with links.'