diff --git a/.github/workflows/release-channels.yml b/.github/workflows/release-channels.yml index 5a0ae01..87e27ea 100644 --- a/.github/workflows/release-channels.yml +++ b/.github/workflows/release-channels.yml @@ -7,7 +7,7 @@ on: types: [published] jobs: - latest-build: + dev-build: if: github.ref == 'refs/heads/develop' runs-on: ubuntu-latest steps: @@ -29,12 +29,12 @@ jobs: run: | ./scripts/testing/run-tests.zsh - - name: Update Homebrew Latest Channel + - name: Update Homebrew Dev Channel env: HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TOKEN }} run: | - # Update goprox@latest formula - ./scripts/release/update-homebrew-channel.zsh latest + # Update goprox@dev formula + ./scripts/release/update-homebrew-channel.zsh dev beta-release: if: startsWith(github.ref, 'refs/heads/release/') @@ -97,11 +97,11 @@ jobs: channel-validation: if: always() runs-on: ubuntu-latest - needs: [latest-build, beta-release, official-release] + needs: [dev-build, beta-release, official-release] steps: - name: Validate Channel Updates run: | echo "Channel update validation completed" - echo "Latest build: ${{ needs.latest-build.result }}" + echo "Dev build: ${{ needs.dev-build.result }}" echo "Beta release: ${{ needs.beta-release.result }}" echo "Official release: ${{ needs.official-release.result }}" diff --git a/docs/feature-planning/issue-20-git-flow-model/GIT_FLOW_IMPLEMENTATION_PLAN.md b/docs/feature-planning/issue-20-git-flow-model/GIT_FLOW_IMPLEMENTATION_PLAN.md index d363ed8..e4233ca 100644 --- a/docs/feature-planning/issue-20-git-flow-model/GIT_FLOW_IMPLEMENTATION_PLAN.md +++ b/docs/feature-planning/issue-20-git-flow-model/GIT_FLOW_IMPLEMENTATION_PLAN.md @@ -11,11 +11,11 @@ This plan provides a focused approach to implementing git-flow for the GoProX pr ### Release Channels Overview -**1. Latest Build Channel (develop branch)** +**1. Dev Build Channel (develop branch)** - **Purpose**: Continuous integration builds for development testing - **Source**: `develop` branch - **Audience**: Developers, early adopters, testing -- **Installation**: `brew install fxstein/tap/goprox@latest` +- **Installation**: `brew install fxstein/tap/goprox@dev` - **Update Frequency**: On every develop branch push - **Stability**: Development quality, may contain bugs @@ -73,9 +73,9 @@ class GoproxBeta < Formula end end -# Formula/goprox@latest.rb - Latest build channel -class GoproxLatest < Formula - desc "GoPro media management tool (latest build)" +# Formula/goprox@dev.rb - Dev build channel +class GoproxDev < Formula + desc "GoPro media management tool (development build)" homepage "https://github.com/fxstein/GoProX" version "01.11.00-dev.$(date +%Y%m%d)" url "https://github.com/fxstein/GoProX/archive/develop.tar.gz" @@ -106,17 +106,17 @@ on: types: [published] jobs: - latest-build: + dev-build: if: github.ref == 'refs/heads/develop' runs-on: ubuntu-latest steps: - - name: Build Latest Version - - name: Update Homebrew Latest Channel + - name: Build Dev Version + - name: Update Homebrew Dev Channel env: HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TOKEN }} run: | - # Update goprox@latest formula - ./scripts/release/update-homebrew-channel.zsh latest + # Update goprox@dev formula + ./scripts/release/update-homebrew-channel.zsh dev beta-release: if: startsWith(github.ref, 'refs/heads/release/') @@ -151,7 +151,7 @@ jobs: # scripts/release/update-homebrew-channel.zsh # Update Homebrew formula for specific channel -# Usage: ./update-homebrew-channel.zsh [latest|beta|official] +# Usage: ./update-homebrew-channel.zsh [dev|beta|official] local channel="$1" local version="" @@ -159,7 +159,7 @@ local url="" local sha256="" case $channel in - latest) + dev) version="$(date +%Y%m%d)-dev" url="https://github.com/fxstein/GoProX/archive/develop.tar.gz" ;; @@ -172,7 +172,7 @@ case $channel in url="https://github.com/fxstein/GoProX/archive/v${version}.tar.gz" ;; *) - echo "Error: Invalid channel. Use: latest, beta, or official" + echo "Error: Invalid channel. Use: dev, beta, or official" exit 1 ;; esac @@ -274,7 +274,7 @@ _update_homebrew_formula "$channel" "$version" "$url" "$sha256" **Multi-Channel Implementation Steps:** 1. **Homebrew Tap Enhancement** - - Create additional formula files for beta and latest channels + - Create additional formula files for beta and dev channels - Set up channel-specific versioning and naming conventions - Configure channel-specific installation paths and dependencies @@ -401,7 +401,7 @@ on: - [ ] First successful release using git-flow ### Multi-Channel Release Criteria -- [ ] Three Homebrew channels operational (latest, beta, official) +- [ ] Three Homebrew channels operational (dev, beta, official) - [ ] Automated formula updates for all channels - [ ] Channel-specific versioning and naming conventions - [ ] User documentation for channel selection and installation @@ -444,7 +444,7 @@ brew install fxstein/tap/goprox@beta **For Developers (Latest Builds):** ```zsh # Install latest development build -brew install fxstein/tap/goprox@latest +brew install fxstein/tap/goprox@dev ``` - **Use Case**: Development testing, early adopters, debugging - **Stability**: Development quality - may contain bugs @@ -459,12 +459,12 @@ brew install fxstein/tap/goprox@latest brew uninstall fxstein/tap/goprox brew install fxstein/tap/goprox@beta -# Switch from beta to latest +# Switch from beta to dev brew uninstall fxstein/tap/goprox@beta -brew install fxstein/tap/goprox@latest +brew install fxstein/tap/goprox@dev -# Downgrade from latest to official -brew uninstall fxstein/tap/goprox@latest +# Downgrade from dev to official +brew uninstall fxstein/tap/goprox@dev brew install fxstein/tap/goprox ``` @@ -482,7 +482,7 @@ brew info fxstein/tap/goprox@beta ### Channel-Specific Features -**Latest Build Channel:** +**Dev Build Channel:** - Access to cutting-edge features - Development debugging information - Experimental functionality diff --git a/docs/git-flow/GIT_FLOW_GUIDE.md b/docs/git-flow/GIT_FLOW_GUIDE.md index 7f97647..c97abb7 100644 --- a/docs/git-flow/GIT_FLOW_GUIDE.md +++ b/docs/git-flow/GIT_FLOW_GUIDE.md @@ -150,8 +150,8 @@ git push origin --delete hotfix/critical-fix ### Release Channels -**1. Latest Build Channel (develop branch):** -- **Installation**: `brew install fxstein/tap/goprox@latest` +**1. Dev Build Channel (develop branch):** +- **Installation**: `brew install fxstein/tap/goprox@dev` - **Source**: `develop` branch - **Update Frequency**: On every develop push - **Audience**: Developers, early adopters @@ -179,12 +179,12 @@ git push origin --delete hotfix/critical-fix brew uninstall fxstein/tap/goprox brew install fxstein/tap/goprox@beta -# Switch from beta to latest +# Switch from beta to dev brew uninstall fxstein/tap/goprox@beta -brew install fxstein/tap/goprox@latest +brew install fxstein/tap/goprox@dev -# Downgrade from latest to official -brew uninstall fxstein/tap/goprox@latest +# Downgrade from dev to official +brew uninstall fxstein/tap/goprox@dev brew install fxstein/tap/goprox ``` diff --git a/goprox b/goprox index e402df3..72f2c08 100755 --- a/goprox +++ b/goprox @@ -34,7 +34,7 @@ fi __author__='Oliver Ratzesberger ' __copyright__='Copyright (C) 2021-2025 Oliver Ratzesberger' __license__='MIT' -__version__='01.12.1-dev' +__version__='01.13.00' __github__='https://github.com/fxstein/GoProX' __this__=$(basename $0) diff --git a/scripts/release/test-homebrew-channels.zsh b/scripts/release/test-homebrew-channels.zsh new file mode 100755 index 0000000..0eeb275 --- /dev/null +++ b/scripts/release/test-homebrew-channels.zsh @@ -0,0 +1,294 @@ +#!/bin/zsh + +# Homebrew Multi-Channel Test Script +# Tests all Homebrew channels to ensure they work correctly +# Usage: ./test-homebrew-channels.zsh [--dry-run] + +# Source logger +SCRIPT_DIR="${0:A:h}" +source "$SCRIPT_DIR/../../scripts/core/logger.zsh" + +# Configuration +DRY_RUN=${DRY_RUN:-false} +TEST_CHANNELS=("dev" "beta" "official") +TEMP_DIR=$(mktemp -d) + +# Function to display help +show_help() { + echo "Homebrew Multi-Channel Test Script" + echo "" + echo "Usage: $0 [--dry-run]" + echo "" + echo "Options:" + echo " --dry-run - Test without making actual changes" + echo " --help, -h - Show this help message" + echo "" + echo "This script tests all Homebrew channels to ensure they work correctly." + echo "It validates formula generation, URL accessibility, and SHA256 calculation." + echo "" +} + +# Parse command line arguments +while [[ $# -gt 0 ]]; do + case $1 in + --dry-run) + DRY_RUN=true + shift + ;; + --help|-h) + show_help + exit 0 + ;; + *) + log_error "Unknown option: $1" + show_help + exit 1 + ;; + esac +done + +log_info "Starting Homebrew multi-channel test (DRY_RUN: $DRY_RUN)" + +# Function to test a single channel +test_channel() { + local channel="$1" + local version="" + local url="" + local formula_name="" + + log_info "Testing channel: $channel" + + case $channel in + dev) + version="$(date +%Y%m%d)-dev" + url="https://codeload.github.com/fxstein/GoProX/tar.gz/develop" + formula_name="goprox@dev" + ;; + beta) + version="$(git describe --tags --abbrev=0)-beta.$(date +%Y%m%d)" + url="https://codeload.github.com/fxstein/GoProX/tar.gz/$(git rev-parse HEAD)" + formula_name="goprox@beta" + ;; + official) + version="$(git describe --tags --abbrev=0)" + # Remove leading 'v' if present for the URL + tag="${version#v}" + url="https://codeload.github.com/fxstein/GoProX/tar.gz/v${tag}" + formula_name="goprox" + ;; + esac + + log_info " Version: $version" + log_info " URL: $url" + log_info " Formula: $formula_name" + + # Test URL accessibility + log_info " Testing URL accessibility..." + if curl -s --head "$url" | head -n 1 | grep "HTTP/.* 200" > /dev/null; then + log_success " ✅ URL is accessible" + else + log_error " ❌ URL is not accessible: $url" + return 1 + fi + + # Test SHA256 calculation + log_info " Testing SHA256 calculation..." + local sha256=$(curl -sL "$url" | sha256sum | cut -d' ' -f1) + if [[ -n "$sha256" && ${#sha256} -eq 64 ]]; then + log_success " ✅ SHA256 calculated successfully: ${sha256:0:8}..." + else + log_error " ❌ SHA256 calculation failed" + return 1 + fi + + # Test formula generation + log_info " Testing formula generation..." + local formula_file="$TEMP_DIR/${formula_name}.rb" + + case $channel in + dev) + cat > "$formula_file" << EOF +class GoproxDev < Formula + desc "GoPro media management tool (dev build)" + homepage "https://github.com/fxstein/GoProX" + version "$version" + url "$url" + sha256 "$sha256" + + depends_on "zsh" + depends_on "exiftool" + depends_on "jq" + + def install + bin.install "goprox" + man1.install "man/goprox.1" + end + + test do + system "#{bin}/goprox", "--version" + end +end +EOF + ;; + beta) + cat > "$formula_file" << EOF +class GoproxBeta < Formula + desc "GoPro media management tool (beta)" + homepage "https://github.com/fxstein/GoProX" + version "$version" + url "$url" + sha256 "$sha256" + + depends_on "zsh" + depends_on "exiftool" + depends_on "jq" + + def install + bin.install "goprox" + man1.install "man/goprox.1" + end + + test do + system "#{bin}/goprox", "--version" + end +end +EOF + ;; + official) + cat > "$formula_file" << EOF +class Goprox < Formula + desc "GoPro media management tool" + homepage "https://github.com/fxstein/GoProX" + version "$version" + url "$url" + sha256 "$sha256" + + depends_on "zsh" + depends_on "exiftool" + depends_on "jq" + + def install + bin.install "goprox" + man1.install "man/goprox.1" + end + + test do + system "#{bin}/goprox", "--version" + end +end +EOF + ;; + esac + + if [[ -f "$formula_file" ]]; then + log_success " ✅ Formula generated successfully" + + # Test formula syntax + if ruby -c "$formula_file" > /dev/null 2>&1; then + log_success " ✅ Formula syntax is valid" + else + log_error " ❌ Formula syntax is invalid" + return 1 + fi + else + log_error " ❌ Formula generation failed" + return 1 + fi + + log_success "Channel $channel test completed successfully" + return 0 +} + +# Function to test channel switching +test_channel_switching() { + log_info "Testing channel switching scenarios..." + + local scenarios=( + "official-to-beta" + "beta-to-dev" + "dev-to-official" + "official-to-dev" + ) + + for scenario in "${scenarios[@]}"; do + log_info " Testing scenario: $scenario" + + case $scenario in + "official-to-beta") + echo "brew uninstall fxstein/tap/goprox" + echo "brew install fxstein/tap/goprox@beta" + ;; + "beta-to-dev") + echo "brew uninstall fxstein/tap/goprox@beta" + echo "brew install fxstein/tap/goprox@dev" + ;; + "dev-to-official") + echo "brew uninstall fxstein/tap/goprox@dev" + echo "brew install fxstein/tap/goprox" + ;; + "official-to-dev") + echo "brew uninstall fxstein/tap/goprox" + echo "brew install fxstein/tap/goprox@dev" + ;; + esac + + log_success " ✅ Scenario $scenario commands generated" + done +} + +# Main test execution +main() { + log_info "Starting comprehensive Homebrew multi-channel test" + + local failed_channels=() + local successful_channels=() + + # Test each channel + for channel in "${TEST_CHANNELS[@]}"; do + if test_channel "$channel"; then + successful_channels+=("$channel") + else + failed_channels+=("$channel") + fi + echo "" + done + + # Test channel switching + test_channel_switching + + # Generate test report + echo "" + log_info "=== Test Report ===" + log_info "Successful channels: ${successful_channels[*]}" + log_info "Failed channels: ${failed_channels[*]}" + + if [[ ${#failed_channels[@]} -eq 0 ]]; then + log_success "✅ All channels tested successfully!" + echo "" + echo "🎉 Multi-channel Homebrew integration is working correctly!" + echo "📦 Channels available:" + echo " • Official: brew install fxstein/tap/goprox" + echo " • Beta: brew install fxstein/tap/goprox@beta" + echo " • Dev: brew install fxstein/tap/goprox@dev" + echo "" + echo "🔄 Channel switching commands:" + test_channel_switching + else + log_error "❌ Some channels failed testing: ${failed_channels[*]}" + exit 1 + fi +} + +# Cleanup function +cleanup() { + if [[ -d "$TEMP_DIR" ]]; then + rm -rf "$TEMP_DIR" + log_info "Cleaned up temporary directory: $TEMP_DIR" + fi +} + +# Set up cleanup trap +trap cleanup EXIT + +# Run main function +main "$@" \ No newline at end of file diff --git a/scripts/release/update-homebrew-channel.zsh b/scripts/release/update-homebrew-channel.zsh index fc094b9..b01607a 100755 --- a/scripts/release/update-homebrew-channel.zsh +++ b/scripts/release/update-homebrew-channel.zsh @@ -2,13 +2,38 @@ # Homebrew Multi-Channel Update Script # Updates Homebrew formula for specific release channel -# Usage: ./update-homebrew-channel.zsh [latest|beta|official] +# Usage: ./update-homebrew-channel.zsh [dev|beta|official] # Source logger -source "$(dirname "$0")/../../scripts/core/logger.zsh" - -# Initialize logger -init_logger "homebrew-channel-update" "info" +SCRIPT_DIR="${0:A:h}" +source "$SCRIPT_DIR/../../scripts/core/logger.zsh" + +# Function to display help +show_help() { + echo "Homebrew Multi-Channel Update Script" + echo "" + echo "Usage: $0 [dev|beta|official]" + echo "" + echo "Channels:" + echo " dev - Update goprox@dev formula (develop branch)" + echo " beta - Update goprox@beta formula (release branches)" + echo " official - Update goprox formula (main branch releases)" + echo "" + echo "Environment Variables:" + echo " HOMEBREW_TOKEN - GitHub Personal Access Token with 'repo' scope" + echo "" + echo "Examples:" + echo " $0 dev # Update dev build channel" + echo " $0 beta # Update beta channel" + echo " $0 official # Update official channel" + echo "" +} + +# Check for help flag +if [[ "$1" == "--help" || "$1" == "-h" ]]; then + show_help + exit 0 +fi log_info "Starting Homebrew channel update for channel: $1" @@ -16,18 +41,18 @@ log_info "Starting Homebrew channel update for channel: $1" local channel="$1" if [[ -z "$channel" ]]; then log_error "Error: Channel parameter required" - echo "Usage: $0 [latest|beta|official]" + show_help exit 1 fi # Validate channel value case $channel in - latest|beta|official) + dev|beta|official) log_info "Valid channel specified: $channel" ;; *) - log_error "Error: Invalid channel '$channel'. Use: latest, beta, or official" - echo "Usage: $0 [latest|beta|official]" + log_error "Error: Invalid channel '$channel'. Use: dev, beta, or official" + show_help exit 1 ;; esac @@ -46,12 +71,12 @@ local formula_name="" local formula_file="" case $channel in - latest) + dev) version="$(date +%Y%m%d)-dev" url="https://github.com/fxstein/GoProX/archive/develop.tar.gz" - formula_name="goprox@latest" - formula_file="Formula/goprox@latest.rb" - log_info "Latest build channel - version: $version" + formula_name="goprox@dev" + formula_file="Formula/goprox@dev.rb" + log_info "Dev build channel - version: $version" ;; beta) version="$(git describe --tags --abbrev=0)-beta.$(date +%Y%m%d)" @@ -93,10 +118,10 @@ cd homebrew-fxstein log_info "Updating formula file: $formula_file" case $channel in - latest) + dev) cat > "$formula_file" << EOF -class GoproxLatest < Formula - desc "GoPro media management tool (latest build)" +class GoproxDev < Formula + desc "GoPro media management tool (dev build)" homepage "https://github.com/fxstein/GoProX" version "$version" url "$url"