From c37c44ae9d663a581165e62fbd7a88c15872e951 Mon Sep 17 00:00:00 2001 From: Mahmoud Elshamy Date: Mon, 29 Dec 2025 20:04:53 +0400 Subject: [PATCH 01/12] Add per-module versioning and selective CI/CD builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Split single metacto-core version into separate versions per module - Update version catalog references to use individual version refs - Modify UpdateVersionCatalogTask to support per-module updates - Rewrite deployNewCore.yml workflow with: - Change detection to identify modified modules - Path filters to ignore samples and docs - buildSrc changes trigger all module builds - Conditional parallel jobs per module - Finalize job to merge and commit version catalog 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .github/workflows/deployNewCore.yml | 771 +++++++++++++++++- build.gradle.kts | 17 +- .../main/kotlin/UpdateVersionCatalogTask.kt | 92 ++- gradle/libs.versions.toml | 27 +- 4 files changed, 857 insertions(+), 50 deletions(-) diff --git a/.github/workflows/deployNewCore.yml b/.github/workflows/deployNewCore.yml index e70bbe5d..630d6d79 100644 --- a/.github/workflows/deployNewCore.yml +++ b/.github/workflows/deployNewCore.yml @@ -1,24 +1,109 @@ -name: Build & upload the debug package -# Trigger on every tag creation +name: Build & Publish Changed Modules + on: push: branches: - 'new_core' -# A workflow run is made up of one or more jobs that can run sequentially or in parallel + paths-ignore: + - 'samples/**' + - 'core/sample/**' + - 'ui/sample/**' + - '**.md' + - '.gitignore' + +env: + VERSION_PREFIX: "0.2" + VERSION_SUFFIX: "-alpha" + jobs: - build: + # ============================================ + # DETECT CHANGES + # ============================================ + detect-changes: + runs-on: ubuntu-latest + outputs: + core: ${{ steps.changes.outputs.core }} + coreui: ${{ steps.changes.outputs.coreui }} + files: ${{ steps.changes.outputs.files }} + notifications: ${{ steps.changes.outputs.notifications }} + phonecore: ${{ steps.changes.outputs.phonecore }} + camera: ${{ steps.changes.outputs.camera }} + mediaplayers: ${{ steps.changes.outputs.mediaplayers }} + youtube: ${{ steps.changes.outputs.youtube }} + phoneui: ${{ steps.changes.outputs.phoneui }} + imagepicker: ${{ steps.changes.outputs.imagepicker }} + buildsrc: ${{ steps.changes.outputs.buildsrc }} + any_module: ${{ steps.changes.outputs.any_module }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Detect changed modules + id: changes + run: | + # Get changed files between current and previous commit + CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD 2>/dev/null || git diff --name-only HEAD) + echo "Changed files:" + echo "$CHANGED_FILES" + echo "" + + # Check buildSrc changes (triggers all modules) + BUILDSRC_CHANGED=$(echo "$CHANGED_FILES" | grep -q '^buildSrc/' && echo 'true' || echo 'false') + echo "buildsrc=$BUILDSRC_CHANGED" >> $GITHUB_OUTPUT + + # Detect per-module changes + detect_module() { + local module_name=$1 + local path_pattern=$2 + local changed=$(echo "$CHANGED_FILES" | grep -qE "$path_pattern" && echo 'true' || echo 'false') + # If buildSrc changed, mark all modules as changed + if [ "$BUILDSRC_CHANGED" = "true" ]; then + changed="true" + fi + echo "$module_name=$changed" >> $GITHUB_OUTPUT + echo "$module_name: $changed" + } + + detect_module "core" "^core/core/" + detect_module "coreui" "^ui/core-ui/" + detect_module "files" "^core/files/" + detect_module "notifications" "^core/notifications/" + detect_module "phonecore" "^core/phone-core/" + detect_module "camera" "^ui/camera/" + detect_module "mediaplayers" "^ui/media-players/" + detect_module "youtube" "^ui/youtube/" + detect_module "phoneui" "^ui/phone-ui/" + detect_module "imagepicker" "^ui/image-picker/" + + # Check if any module changed + if [ "$BUILDSRC_CHANGED" = "true" ] || echo "$CHANGED_FILES" | grep -qE '^(core/(core|files|notifications|phone-core)|ui/(core-ui|camera|media-players|youtube|phone-ui|image-picker))/'; then + echo "any_module=true" >> $GITHUB_OUTPUT + else + echo "any_module=false" >> $GITHUB_OUTPUT + fi + + # ============================================ + # PUBLISH: CORE + # ============================================ + publish-core: + needs: detect-changes + if: needs.detect-changes.outputs.core == 'true' runs-on: macos-latest permissions: contents: write packages: write + outputs: + version: ${{ steps.version.outputs.version }} steps: - - uses: actions/checkout@v3 - - name: set up JDK 17 - uses: actions/setup-java@v1 + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 with: java-version: 17 + distribution: 'temurin' - name: Cache Gradle - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.gradle/caches @@ -27,7 +112,7 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - name: Cache Konan - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.konan/caches @@ -36,37 +121,669 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- + - name: Calculate version + id: version + run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + - name: Update local properties + env: + PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} + PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} + run: | + echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties + echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + - name: Update version in catalog + run: ./gradlew updateVersionCatalog_core -PmoduleVersion=${{ steps.version.outputs.version }} + - name: Publish core module + run: ./gradlew :core:core:publishAllPublicationsToGithubRepository + - name: Upload updated version catalog + uses: actions/upload-artifact@v4 + with: + name: version-catalog-core + path: gradle/libs.versions.toml + # ============================================ + # PUBLISH: CORE-UI + # ============================================ + publish-coreui: + needs: detect-changes + if: needs.detect-changes.outputs.coreui == 'true' + runs-on: macos-latest + permissions: + contents: write + packages: write + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + - name: Cache Gradle + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Cache Konan + uses: actions/cache@v4 + with: + path: | + ~/.konan/caches + ~/.konan/dependencies + ~/.konan/kotlin-native-prebuilt-macos-* + key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} + restore-keys: | + ${{ runner.os }}-konan- + - name: Calculate version + id: version + run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT - name: Update local properties env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} - PUBLISH_CORE_VERSION: 0.2.${{ github.run_number }}-alpha - run: echo PUBLISH_REPO_USER=$PUBLISH_REPO_USER$'\n' - PUBLISH_CORE_VERSION=$PUBLISH_CORE_VERSION$'\n' - PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN > ./local.properties + run: | + echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties + echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + - name: Update version in catalog + run: ./gradlew updateVersionCatalog_coreui -PmoduleVersion=${{ steps.version.outputs.version }} + - name: Publish core-ui module + run: ./gradlew :ui:core-ui:publishAllPublicationsToGithubRepository + - name: Upload updated version catalog + uses: actions/upload-artifact@v4 + with: + name: version-catalog-coreui + path: gradle/libs.versions.toml - - name: Print local.properties content - run: cat ./local.properties + # ============================================ + # PUBLISH: FILES + # ============================================ + publish-files: + needs: detect-changes + if: needs.detect-changes.outputs.files == 'true' + runs-on: macos-latest + permissions: + contents: write + packages: write + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + - name: Cache Gradle + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Cache Konan + uses: actions/cache@v4 + with: + path: | + ~/.konan/caches + ~/.konan/dependencies + ~/.konan/kotlin-native-prebuilt-macos-* + key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} + restore-keys: | + ${{ runner.os }}-konan- + - name: Calculate version + id: version + run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + - name: Update local properties + env: + PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} + PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} + run: | + echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties + echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + - name: Update version in catalog + run: ./gradlew updateVersionCatalog_files -PmoduleVersion=${{ steps.version.outputs.version }} + - name: Publish files module + run: ./gradlew :core:files:publishAllPublicationsToGithubRepository + - name: Upload updated version catalog + uses: actions/upload-artifact@v4 + with: + name: version-catalog-files + path: gradle/libs.versions.toml - - name: Update versions properties + # ============================================ + # PUBLISH: NOTIFICATIONS + # ============================================ + publish-notifications: + needs: detect-changes + if: needs.detect-changes.outputs.notifications == 'true' + runs-on: macos-latest + permissions: + contents: write + packages: write + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + - name: Cache Gradle + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Cache Konan + uses: actions/cache@v4 + with: + path: | + ~/.konan/caches + ~/.konan/dependencies + ~/.konan/kotlin-native-prebuilt-macos-* + key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} + restore-keys: | + ${{ runner.os }}-konan- + - name: Calculate version + id: version + run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + - name: Update local properties env: - PUBLISH_CORE_VERSION: 0.2.${{ github.run_number }}-alpha - run: echo PUBLISH_CORE_VERSION=$PUBLISH_CORE_VERSION> ./versions.properties + PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} + PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} + run: | + echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties + echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + - name: Update version in catalog + run: ./gradlew updateVersionCatalog_notifications -PmoduleVersion=${{ steps.version.outputs.version }} + - name: Publish notifications module + run: ./gradlew :core:notifications:publishAllPublicationsToGithubRepository + - name: Upload updated version catalog + uses: actions/upload-artifact@v4 + with: + name: version-catalog-notifications + path: gradle/libs.versions.toml - - name: Print versions.properties content - run: cat ./versions.properties + # ============================================ + # PUBLISH: PHONE-CORE + # ============================================ + publish-phonecore: + needs: detect-changes + if: needs.detect-changes.outputs.phonecore == 'true' + runs-on: macos-latest + permissions: + contents: write + packages: write + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + - name: Cache Gradle + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Cache Konan + uses: actions/cache@v4 + with: + path: | + ~/.konan/caches + ~/.konan/dependencies + ~/.konan/kotlin-native-prebuilt-macos-* + key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} + restore-keys: | + ${{ runner.os }}-konan- + - name: Calculate version + id: version + run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + - name: Update local properties + env: + PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} + PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} + run: | + echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties + echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + - name: Update version in catalog + run: ./gradlew updateVersionCatalog_phonecore -PmoduleVersion=${{ steps.version.outputs.version }} + - name: Publish phone-core module + run: ./gradlew :core:phone-core:publishAllPublicationsToGithubRepository + - name: Upload updated version catalog + uses: actions/upload-artifact@v4 + with: + name: version-catalog-phonecore + path: gradle/libs.versions.toml - - name: Update version catalog - run: ./gradlew updateVersionCatalog + # ============================================ + # PUBLISH: CAMERA + # ============================================ + publish-camera: + needs: detect-changes + if: needs.detect-changes.outputs.camera == 'true' + runs-on: macos-latest + permissions: + contents: write + packages: write + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + - name: Cache Gradle + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Cache Konan + uses: actions/cache@v4 + with: + path: | + ~/.konan/caches + ~/.konan/dependencies + ~/.konan/kotlin-native-prebuilt-macos-* + key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} + restore-keys: | + ${{ runner.os }}-konan- + - name: Calculate version + id: version + run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + - name: Update local properties + env: + PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} + PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} + run: | + echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties + echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + - name: Update version in catalog + run: ./gradlew updateVersionCatalog_camera -PmoduleVersion=${{ steps.version.outputs.version }} + - name: Publish camera module + run: ./gradlew :ui:camera:publishAllPublicationsToGithubRepository + - name: Upload updated version catalog + uses: actions/upload-artifact@v4 + with: + name: version-catalog-camera + path: gradle/libs.versions.toml - - name: Commit updated version catalog + # ============================================ + # PUBLISH: MEDIA-PLAYERS + # ============================================ + publish-mediaplayers: + needs: detect-changes + if: needs.detect-changes.outputs.mediaplayers == 'true' + runs-on: macos-latest + permissions: + contents: write + packages: write + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + - name: Cache Gradle + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Cache Konan + uses: actions/cache@v4 + with: + path: | + ~/.konan/caches + ~/.konan/dependencies + ~/.konan/kotlin-native-prebuilt-macos-* + key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} + restore-keys: | + ${{ runner.os }}-konan- + - name: Calculate version + id: version + run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + - name: Update local properties + env: + PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} + PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} + run: | + echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties + echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + - name: Update version in catalog + run: ./gradlew updateVersionCatalog_mediaplayers -PmoduleVersion=${{ steps.version.outputs.version }} + - name: Publish media-players module + run: ./gradlew :ui:media-players:publishAllPublicationsToGithubRepository + - name: Upload updated version catalog + uses: actions/upload-artifact@v4 + with: + name: version-catalog-mediaplayers + path: gradle/libs.versions.toml + + # ============================================ + # PUBLISH: YOUTUBE + # ============================================ + publish-youtube: + needs: detect-changes + if: needs.detect-changes.outputs.youtube == 'true' + runs-on: macos-latest + permissions: + contents: write + packages: write + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + - name: Cache Gradle + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Cache Konan + uses: actions/cache@v4 + with: + path: | + ~/.konan/caches + ~/.konan/dependencies + ~/.konan/kotlin-native-prebuilt-macos-* + key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} + restore-keys: | + ${{ runner.os }}-konan- + - name: Calculate version + id: version + run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + - name: Update local properties + env: + PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} + PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} + run: | + echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties + echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + - name: Update version in catalog + run: ./gradlew updateVersionCatalog_youtube -PmoduleVersion=${{ steps.version.outputs.version }} + - name: Publish youtube module + run: ./gradlew :ui:youtube:publishAllPublicationsToGithubRepository + - name: Upload updated version catalog + uses: actions/upload-artifact@v4 + with: + name: version-catalog-youtube + path: gradle/libs.versions.toml + + # ============================================ + # PUBLISH: PHONE-UI + # ============================================ + publish-phoneui: + needs: detect-changes + if: needs.detect-changes.outputs.phoneui == 'true' + runs-on: macos-latest + permissions: + contents: write + packages: write + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + - name: Cache Gradle + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Cache Konan + uses: actions/cache@v4 + with: + path: | + ~/.konan/caches + ~/.konan/dependencies + ~/.konan/kotlin-native-prebuilt-macos-* + key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} + restore-keys: | + ${{ runner.os }}-konan- + - name: Calculate version + id: version + run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + - name: Update local properties + env: + PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} + PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} + run: | + echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties + echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + - name: Update version in catalog + run: ./gradlew updateVersionCatalog_phoneui -PmoduleVersion=${{ steps.version.outputs.version }} + - name: Publish phone-ui module + run: ./gradlew :ui:phone-ui:publishAllPublicationsToGithubRepository + - name: Upload updated version catalog + uses: actions/upload-artifact@v4 + with: + name: version-catalog-phoneui + path: gradle/libs.versions.toml + + # ============================================ + # PUBLISH: IMAGE-PICKER + # ============================================ + publish-imagepicker: + needs: detect-changes + if: needs.detect-changes.outputs.imagepicker == 'true' + runs-on: macos-latest + permissions: + contents: write + packages: write + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + - name: Cache Gradle + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Cache Konan + uses: actions/cache@v4 + with: + path: | + ~/.konan/caches + ~/.konan/dependencies + ~/.konan/kotlin-native-prebuilt-macos-* + key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} + restore-keys: | + ${{ runner.os }}-konan- + - name: Calculate version + id: version + run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + - name: Update local properties + env: + PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} + PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} + run: | + echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties + echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + - name: Update version in catalog + run: ./gradlew updateVersionCatalog_imagepicker -PmoduleVersion=${{ steps.version.outputs.version }} + - name: Publish image-picker module + run: ./gradlew :ui:image-picker:publishAllPublicationsToGithubRepository + - name: Upload updated version catalog + uses: actions/upload-artifact@v4 + with: + name: version-catalog-imagepicker + path: gradle/libs.versions.toml + + # ============================================ + # FINALIZE: Merge version catalogs and commit + # ============================================ + finalize: + needs: + - detect-changes + - publish-core + - publish-coreui + - publish-files + - publish-notifications + - publish-phonecore + - publish-camera + - publish-mediaplayers + - publish-youtube + - publish-phoneui + - publish-imagepicker + if: always() && needs.detect-changes.outputs.any_module == 'true' + runs-on: macos-latest + permissions: + contents: write + packages: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + + - name: Cache Gradle + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Download all version catalog artifacts + uses: actions/download-artifact@v4 + with: + path: version-catalogs + pattern: version-catalog-* + + - name: Merge version catalogs + run: | + VERSION="${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" + echo "Merging version catalogs with version: $VERSION" + + # Start with the base version catalog + cp gradle/libs.versions.toml gradle/libs.versions.toml.merged + + # Apply updates from each published module + update_version() { + local module=$1 + local version_key=$2 + if [ -f "version-catalogs/version-catalog-$module/libs.versions.toml" ]; then + echo "Updating $version_key to $VERSION" + sed -i '' "s/$version_key = \"[^\"]*\"/$version_key = \"$VERSION\"/" gradle/libs.versions.toml.merged + fi + } + + update_version "core" "metacto-core" + update_version "coreui" "metacto-coreui" + update_version "files" "metacto-files" + update_version "notifications" "metacto-notifications" + update_version "phonecore" "metacto-phonecore" + update_version "camera" "metacto-camera" + update_version "mediaplayers" "metacto-mediaplayers" + update_version "youtube" "metacto-youtube" + update_version "phoneui" "metacto-phoneui" + update_version "imagepicker" "metacto-imagepicker" + + mv gradle/libs.versions.toml.merged gradle/libs.versions.toml + + echo "Updated version catalog:" + head -30 gradle/libs.versions.toml + + - name: Update local properties + env: + PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} + PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} + run: | + echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties + echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties + + - name: Publish version catalog + run: ./gradlew :version-catalog:publishAllPublicationsToGithubRepository + + - name: Commit and push updated version catalog run: | git config user.name "GitHub Actions Bot" git config user.email "actions@github.com" git add gradle/libs.versions.toml - git commit -m "Update metacto-core version to 0.2.${{ github.run_number }}-alpha" - git push - - name: Publish to GitHub Packages - run: ./gradlew publishAllPublicationsToGithubRepository + # Build commit message with list of updated modules + MODULES="" + [ -d "version-catalogs/version-catalog-core" ] && MODULES="$MODULES core" + [ -d "version-catalogs/version-catalog-coreui" ] && MODULES="$MODULES core-ui" + [ -d "version-catalogs/version-catalog-files" ] && MODULES="$MODULES files" + [ -d "version-catalogs/version-catalog-notifications" ] && MODULES="$MODULES notifications" + [ -d "version-catalogs/version-catalog-phonecore" ] && MODULES="$MODULES phone-core" + [ -d "version-catalogs/version-catalog-camera" ] && MODULES="$MODULES camera" + [ -d "version-catalogs/version-catalog-mediaplayers" ] && MODULES="$MODULES media-players" + [ -d "version-catalogs/version-catalog-youtube" ] && MODULES="$MODULES youtube" + [ -d "version-catalogs/version-catalog-phoneui" ] && MODULES="$MODULES phone-ui" + [ -d "version-catalogs/version-catalog-imagepicker" ] && MODULES="$MODULES image-picker" + + git commit -m "Update versions to ${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }} for:$MODULES" || echo "No changes to commit" + git push diff --git a/build.gradle.kts b/build.gradle.kts index 9d908dc9..243cbf6f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,9 +14,24 @@ allprojects { repositories.addProjectRepos() } +// Legacy task: updates all modules with PUBLISH_CORE_VERSION tasks.register("updateVersionCatalog") { group = "publishing" - description = "Updates metacto-core version in libs.versions.toml from versions.properties" + description = "Updates all metacto versions in libs.versions.toml from versions.properties" +} + +// Per-module version update tasks +val modules = listOf( + "core", "coreui", "files", "notifications", "phonecore", + "camera", "mediaplayers", "youtube", "phoneui", "imagepicker" +) + +modules.forEach { module -> + tasks.register("updateVersionCatalog_$module") { + group = "publishing" + description = "Updates metacto-$module version in libs.versions.toml" + moduleName.set(module) + } } // Convenience task to update version catalog and publish diff --git a/buildSrc/src/main/kotlin/UpdateVersionCatalogTask.kt b/buildSrc/src/main/kotlin/UpdateVersionCatalogTask.kt index 9d0ec5a8..7cd0557b 100644 --- a/buildSrc/src/main/kotlin/UpdateVersionCatalogTask.kt +++ b/buildSrc/src/main/kotlin/UpdateVersionCatalogTask.kt @@ -1,28 +1,94 @@ import org.gradle.api.DefaultTask +import org.gradle.api.provider.Property +import org.gradle.api.tasks.Input +import org.gradle.api.tasks.Optional import org.gradle.api.tasks.TaskAction import java.io.File import java.util.Properties -open class UpdateVersionCatalogTask : DefaultTask() { +abstract class UpdateVersionCatalogTask : DefaultTask() { + + /** + * The module name to update (e.g., "core", "coreui", "files"). + * If not set, updates all modules based on versions.properties. + */ + @get:Input + @get:Optional + abstract val moduleName: Property + + /** + * The version to set for the module. + * If not set, reads from versions.properties. + */ + @get:Input + @get:Optional + abstract val moduleVersion: Property + + companion object { + // Map of module names to their version key in libs.versions.toml + val MODULE_VERSION_KEYS = mapOf( + "core" to "metacto-core", + "coreui" to "metacto-coreui", + "files" to "metacto-files", + "notifications" to "metacto-notifications", + "phonecore" to "metacto-phonecore", + "camera" to "metacto-camera", + "mediaplayers" to "metacto-mediaplayers", + "youtube" to "metacto-youtube", + "phoneui" to "metacto-phoneui", + "imagepicker" to "metacto-imagepicker" + ) + } @TaskAction fun updateVersion() { - val versionProperties = Properties().apply { - load(File(project.rootDir, "versions.properties").inputStream()) + val libsVersionsFile = File(project.rootDir, "gradle/libs.versions.toml") + var content = libsVersionsFile.readText() + + if (moduleName.isPresent) { + // Update single module + val module = moduleName.get() + val version = when { + moduleVersion.isPresent -> moduleVersion.get() + project.hasProperty("moduleVersion") -> project.property("moduleVersion").toString() + else -> getVersionFromProperties("PUBLISH_${module.uppercase()}_VERSION") + ?: getVersionFromProperties("PUBLISH_CORE_VERSION") + ?: throw IllegalStateException("No version found for module: $module") + } + + val versionKey = MODULE_VERSION_KEYS[module] + ?: throw IllegalArgumentException("Unknown module: $module. Valid modules: ${MODULE_VERSION_KEYS.keys}") + + content = updateVersionInContent(content, versionKey, version) + println("✅ Updated $versionKey version to $version in libs.versions.toml") + } else { + // Legacy behavior: update all modules with PUBLISH_CORE_VERSION + val publishVersion = getVersionFromProperties("PUBLISH_CORE_VERSION") + ?: throw IllegalStateException("PUBLISH_CORE_VERSION not found in versions.properties") + + MODULE_VERSION_KEYS.values.forEach { versionKey -> + content = updateVersionInContent(content, versionKey, publishVersion) + } + println("✅ Updated all metacto versions to $publishVersion in libs.versions.toml") } - val publishVersion = versionProperties.getProperty("PUBLISH_CORE_VERSION") - val libsVersionsFile = File(project.rootDir, "gradle/libs.versions.toml") - val content = libsVersionsFile.readText() + libsVersionsFile.writeText(content) + } - // Update metacto-core version - val updatedContent = content.replace( - Regex("""metacto-core = "[^"]+""""), - """metacto-core = "$publishVersion"""" - ) + private fun getVersionFromProperties(key: String): String? { + val versionPropertiesFile = File(project.rootDir, "versions.properties") + if (!versionPropertiesFile.exists()) return null - libsVersionsFile.writeText(updatedContent) + val properties = Properties().apply { + load(versionPropertiesFile.inputStream()) + } + return properties.getProperty(key) + } - println("✅ Updated metacto-core version to $publishVersion in libs.versions.toml") + private fun updateVersionInContent(content: String, versionKey: String, version: String): String { + return content.replace( + Regex("""$versionKey = "[^"]+""""), + """$versionKey = "$version"""" + ) } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e3dabfd8..e6968e7d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,6 +14,15 @@ serialization-json = "1.6.0" strapi-kmm = "10.0.158" core-network = "2.0.58" metacto-core = "0.2.81-alpha" +metacto-coreui = "0.2.81-alpha" +metacto-files = "0.2.81-alpha" +metacto-notifications = "0.2.81-alpha" +metacto-phonecore = "0.2.81-alpha" +metacto-camera = "0.2.81-alpha" +metacto-mediaplayers = "0.2.81-alpha" +metacto-youtube = "0.2.81-alpha" +metacto-phoneui = "0.2.81-alpha" +metacto-imagepicker = "0.2.81-alpha" metacto-inspektify = "1.0.0-beta09-meta-2" metacto-downloadmanager = "0.0.4-alpha" metacto-firebase = "1.0.34" @@ -157,15 +166,15 @@ uuid = { module = "com.benasher44:uuid", version.ref = "uuid" } #MetaCto metacto-core = { module = "com.metacto.kmm:core", version.ref = "metacto-core" } -metacto-coreui = { module = "com.metacto.kmm:core-ui", version.ref = "metacto-core" } -metacto-files = { module = "com.metacto.kmm:files", version.ref = "metacto-core" } -metacto-notifications = { module = "com.metacto.kmm:notifications", version.ref = "metacto-core" } -metacto-phonecore = { module = "com.metacto.kmm:phone-core", version.ref = "metacto-core" } -metacto-mediaplayers = { module = "com.metacto.kmm:media-players", version.ref = "metacto-core" } -metacto-camera = { module = "com.metacto.kmm:camera", version.ref = "metacto-core" } -metacto-youtube = { module = "com.metacto.kmm:youtube", version.ref = "metacto-core" } -metacto-phoneui = { module = "com.metacto.kmm:phone-ui", version.ref = "metacto-core" } -metacto-imagepicker = { module = "com.metacto.kmm:image-picker", version.ref = "metacto-core" } +metacto-coreui = { module = "com.metacto.kmm:core-ui", version.ref = "metacto-coreui" } +metacto-files = { module = "com.metacto.kmm:files", version.ref = "metacto-files" } +metacto-notifications = { module = "com.metacto.kmm:notifications", version.ref = "metacto-notifications" } +metacto-phonecore = { module = "com.metacto.kmm:phone-core", version.ref = "metacto-phonecore" } +metacto-mediaplayers = { module = "com.metacto.kmm:media-players", version.ref = "metacto-mediaplayers" } +metacto-camera = { module = "com.metacto.kmm:camera", version.ref = "metacto-camera" } +metacto-youtube = { module = "com.metacto.kmm:youtube", version.ref = "metacto-youtube" } +metacto-phoneui = { module = "com.metacto.kmm:phone-ui", version.ref = "metacto-phoneui" } +metacto-imagepicker = { module = "com.metacto.kmm:image-picker", version.ref = "metacto-imagepicker" } metacto-auth-common = { module = "com.metacto.kmm:auth-common", version.ref = "metacto-firebase" } metacto-auth-firebase = { module = "com.metacto.kmm:firebase-auth-extensions", version.ref = "metacto-firebase" } metacto-remoteconfigs-common = { module = "com.metacto.kmm:remote-config-common", version.ref = "metacto-firebase" } From c2e887f64b8081fd48c6dc5d17abad4a01b13c12 Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot Date: Mon, 29 Dec 2025 16:30:42 +0000 Subject: [PATCH 02/12] Update versions to 0.2.82-alpha for: core core-ui files notifications phone-core camera media-players youtube phone-ui image-picker --- gradle/libs.versions.toml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e6968e7d..d1cd448b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,16 +13,16 @@ coroutines = "1.10.2" serialization-json = "1.6.0" strapi-kmm = "10.0.158" core-network = "2.0.58" -metacto-core = "0.2.81-alpha" -metacto-coreui = "0.2.81-alpha" -metacto-files = "0.2.81-alpha" -metacto-notifications = "0.2.81-alpha" -metacto-phonecore = "0.2.81-alpha" -metacto-camera = "0.2.81-alpha" -metacto-mediaplayers = "0.2.81-alpha" -metacto-youtube = "0.2.81-alpha" -metacto-phoneui = "0.2.81-alpha" -metacto-imagepicker = "0.2.81-alpha" +metacto-core = "0.2.82-alpha" +metacto-coreui = "0.2.82-alpha" +metacto-files = "0.2.82-alpha" +metacto-notifications = "0.2.82-alpha" +metacto-phonecore = "0.2.82-alpha" +metacto-camera = "0.2.82-alpha" +metacto-mediaplayers = "0.2.82-alpha" +metacto-youtube = "0.2.82-alpha" +metacto-phoneui = "0.2.82-alpha" +metacto-imagepicker = "0.2.82-alpha" metacto-inspektify = "1.0.0-beta09-meta-2" metacto-downloadmanager = "0.0.4-alpha" metacto-firebase = "1.0.34" From 607ac88bb7072ac95aaeada55779bc1aff430a5c Mon Sep 17 00:00:00 2001 From: Mahmoud Elshamy Date: Mon, 29 Dec 2025 20:46:32 +0400 Subject: [PATCH 03/12] Trigger build --- .../metacto/core/ui/components/pickers/IosNativeDatePicker.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/core-ui/src/iosMain/kotlin/com/metacto/core/ui/components/pickers/IosNativeDatePicker.kt b/ui/core-ui/src/iosMain/kotlin/com/metacto/core/ui/components/pickers/IosNativeDatePicker.kt index d575b2c4..a1295aab 100644 --- a/ui/core-ui/src/iosMain/kotlin/com/metacto/core/ui/components/pickers/IosNativeDatePicker.kt +++ b/ui/core-ui/src/iosMain/kotlin/com/metacto/core/ui/components/pickers/IosNativeDatePicker.kt @@ -310,4 +310,4 @@ private fun NSDate.toLocalDateTime(calendar: NSCalendar): LocalDateTime { minute = components.minute.toInt(), second = components.second.toInt() ) -} +} \ No newline at end of file From f5f2fcd99be8751e5903f196e5bd2e6b77a6cbc4 Mon Sep 17 00:00:00 2001 From: Mahmoud Elshamy Date: Mon, 29 Dec 2025 20:56:04 +0400 Subject: [PATCH 04/12] Fix version incrementing to be per-module based MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Read current version from libs.versions.toml for each module - Parse and increment the patch number (e.g., 0.2.81-alpha -> 0.2.82-alpha) - Each module now increments its own version independently 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .github/workflows/deployNewCore.yml | 272 ++++++++++++++++++++++------ 1 file changed, 220 insertions(+), 52 deletions(-) diff --git a/.github/workflows/deployNewCore.yml b/.github/workflows/deployNewCore.yml index 630d6d79..544fa157 100644 --- a/.github/workflows/deployNewCore.yml +++ b/.github/workflows/deployNewCore.yml @@ -12,7 +12,6 @@ on: - '.gitignore' env: - VERSION_PREFIX: "0.2" VERSION_SUFFIX: "-alpha" jobs: @@ -121,9 +120,25 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate version + - name: Calculate next version id: version - run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + run: | + # Read current version from libs.versions.toml + CURRENT_VERSION=$(grep 'metacto-core = "' gradle/libs.versions.toml | head -1 | sed 's/.*= "\([^"]*\)".*/\1/') + echo "Current version: $CURRENT_VERSION" + + # Parse version components (e.g., 0.2.81-alpha -> 0.2.82-alpha) + VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') # 0.2.81 + MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) + MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) + PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + + # Increment patch + NEW_PATCH=$((PATCH + 1)) + NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" + + echo "New version: $NEW_VERSION" + echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - name: Update local properties env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} @@ -180,9 +195,22 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate version + - name: Calculate next version id: version - run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + run: | + CURRENT_VERSION=$(grep 'metacto-coreui = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "Current version: $CURRENT_VERSION" + + VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') + MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) + MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) + PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + + NEW_PATCH=$((PATCH + 1)) + NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" + + echo "New version: $NEW_VERSION" + echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - name: Update local properties env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} @@ -239,9 +267,22 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate version + - name: Calculate next version id: version - run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + run: | + CURRENT_VERSION=$(grep 'metacto-files = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "Current version: $CURRENT_VERSION" + + VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') + MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) + MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) + PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + + NEW_PATCH=$((PATCH + 1)) + NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" + + echo "New version: $NEW_VERSION" + echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - name: Update local properties env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} @@ -298,9 +339,22 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate version + - name: Calculate next version id: version - run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + run: | + CURRENT_VERSION=$(grep 'metacto-notifications = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "Current version: $CURRENT_VERSION" + + VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') + MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) + MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) + PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + + NEW_PATCH=$((PATCH + 1)) + NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" + + echo "New version: $NEW_VERSION" + echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - name: Update local properties env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} @@ -357,9 +411,22 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate version + - name: Calculate next version id: version - run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + run: | + CURRENT_VERSION=$(grep 'metacto-phonecore = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "Current version: $CURRENT_VERSION" + + VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') + MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) + MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) + PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + + NEW_PATCH=$((PATCH + 1)) + NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" + + echo "New version: $NEW_VERSION" + echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - name: Update local properties env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} @@ -416,9 +483,22 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate version + - name: Calculate next version id: version - run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + run: | + CURRENT_VERSION=$(grep 'metacto-camera = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "Current version: $CURRENT_VERSION" + + VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') + MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) + MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) + PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + + NEW_PATCH=$((PATCH + 1)) + NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" + + echo "New version: $NEW_VERSION" + echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - name: Update local properties env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} @@ -475,9 +555,22 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate version + - name: Calculate next version id: version - run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + run: | + CURRENT_VERSION=$(grep 'metacto-mediaplayers = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "Current version: $CURRENT_VERSION" + + VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') + MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) + MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) + PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + + NEW_PATCH=$((PATCH + 1)) + NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" + + echo "New version: $NEW_VERSION" + echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - name: Update local properties env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} @@ -534,9 +627,22 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate version + - name: Calculate next version id: version - run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + run: | + CURRENT_VERSION=$(grep 'metacto-youtube = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "Current version: $CURRENT_VERSION" + + VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') + MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) + MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) + PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + + NEW_PATCH=$((PATCH + 1)) + NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" + + echo "New version: $NEW_VERSION" + echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - name: Update local properties env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} @@ -593,9 +699,22 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate version + - name: Calculate next version id: version - run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + run: | + CURRENT_VERSION=$(grep 'metacto-phoneui = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "Current version: $CURRENT_VERSION" + + VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') + MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) + MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) + PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + + NEW_PATCH=$((PATCH + 1)) + NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" + + echo "New version: $NEW_VERSION" + echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - name: Update local properties env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} @@ -652,9 +771,22 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate version + - name: Calculate next version id: version - run: echo "version=${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" >> $GITHUB_OUTPUT + run: | + CURRENT_VERSION=$(grep 'metacto-imagepicker = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "Current version: $CURRENT_VERSION" + + VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') + MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) + MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) + PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + + NEW_PATCH=$((PATCH + 1)) + NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" + + echo "New version: $NEW_VERSION" + echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - name: Update local properties env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} @@ -723,32 +855,37 @@ jobs: - name: Merge version catalogs run: | - VERSION="${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }}" - echo "Merging version catalogs with version: $VERSION" + echo "Merging version catalogs..." # Start with the base version catalog cp gradle/libs.versions.toml gradle/libs.versions.toml.merged - # Apply updates from each published module - update_version() { + # Apply updates from each published module's artifact + merge_version() { local module=$1 local version_key=$2 - if [ -f "version-catalogs/version-catalog-$module/libs.versions.toml" ]; then - echo "Updating $version_key to $VERSION" - sed -i '' "s/$version_key = \"[^\"]*\"/$version_key = \"$VERSION\"/" gradle/libs.versions.toml.merged + local artifact_path="version-catalogs/version-catalog-$module/libs.versions.toml" + + if [ -f "$artifact_path" ]; then + # Extract the new version from the artifact + NEW_VERSION=$(grep "$version_key = \"" "$artifact_path" | sed 's/.*= "\([^"]*\)".*/\1/') + if [ -n "$NEW_VERSION" ]; then + echo "Updating $version_key to $NEW_VERSION" + sed -i '' "s/$version_key = \"[^\"]*\"/$version_key = \"$NEW_VERSION\"/" gradle/libs.versions.toml.merged + fi fi } - update_version "core" "metacto-core" - update_version "coreui" "metacto-coreui" - update_version "files" "metacto-files" - update_version "notifications" "metacto-notifications" - update_version "phonecore" "metacto-phonecore" - update_version "camera" "metacto-camera" - update_version "mediaplayers" "metacto-mediaplayers" - update_version "youtube" "metacto-youtube" - update_version "phoneui" "metacto-phoneui" - update_version "imagepicker" "metacto-imagepicker" + merge_version "core" "metacto-core" + merge_version "coreui" "metacto-coreui" + merge_version "files" "metacto-files" + merge_version "notifications" "metacto-notifications" + merge_version "phonecore" "metacto-phonecore" + merge_version "camera" "metacto-camera" + merge_version "mediaplayers" "metacto-mediaplayers" + merge_version "youtube" "metacto-youtube" + merge_version "phoneui" "metacto-phoneui" + merge_version "imagepicker" "metacto-imagepicker" mv gradle/libs.versions.toml.merged gradle/libs.versions.toml @@ -772,18 +909,49 @@ jobs: git config user.email "actions@github.com" git add gradle/libs.versions.toml - # Build commit message with list of updated modules - MODULES="" - [ -d "version-catalogs/version-catalog-core" ] && MODULES="$MODULES core" - [ -d "version-catalogs/version-catalog-coreui" ] && MODULES="$MODULES core-ui" - [ -d "version-catalogs/version-catalog-files" ] && MODULES="$MODULES files" - [ -d "version-catalogs/version-catalog-notifications" ] && MODULES="$MODULES notifications" - [ -d "version-catalogs/version-catalog-phonecore" ] && MODULES="$MODULES phone-core" - [ -d "version-catalogs/version-catalog-camera" ] && MODULES="$MODULES camera" - [ -d "version-catalogs/version-catalog-mediaplayers" ] && MODULES="$MODULES media-players" - [ -d "version-catalogs/version-catalog-youtube" ] && MODULES="$MODULES youtube" - [ -d "version-catalogs/version-catalog-phoneui" ] && MODULES="$MODULES phone-ui" - [ -d "version-catalogs/version-catalog-imagepicker" ] && MODULES="$MODULES image-picker" - - git commit -m "Update versions to ${{ env.VERSION_PREFIX }}.${{ github.run_number }}${{ env.VERSION_SUFFIX }} for:$MODULES" || echo "No changes to commit" + # Build commit message with list of updated modules and their versions + COMMIT_MSG="Update module versions:" + + if [ -d "version-catalogs/version-catalog-core" ]; then + VER=$(grep 'metacto-core = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + COMMIT_MSG="$COMMIT_MSG core@$VER" + fi + if [ -d "version-catalogs/version-catalog-coreui" ]; then + VER=$(grep 'metacto-coreui = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + COMMIT_MSG="$COMMIT_MSG core-ui@$VER" + fi + if [ -d "version-catalogs/version-catalog-files" ]; then + VER=$(grep 'metacto-files = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + COMMIT_MSG="$COMMIT_MSG files@$VER" + fi + if [ -d "version-catalogs/version-catalog-notifications" ]; then + VER=$(grep 'metacto-notifications = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + COMMIT_MSG="$COMMIT_MSG notifications@$VER" + fi + if [ -d "version-catalogs/version-catalog-phonecore" ]; then + VER=$(grep 'metacto-phonecore = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + COMMIT_MSG="$COMMIT_MSG phone-core@$VER" + fi + if [ -d "version-catalogs/version-catalog-camera" ]; then + VER=$(grep 'metacto-camera = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + COMMIT_MSG="$COMMIT_MSG camera@$VER" + fi + if [ -d "version-catalogs/version-catalog-mediaplayers" ]; then + VER=$(grep 'metacto-mediaplayers = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + COMMIT_MSG="$COMMIT_MSG media-players@$VER" + fi + if [ -d "version-catalogs/version-catalog-youtube" ]; then + VER=$(grep 'metacto-youtube = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + COMMIT_MSG="$COMMIT_MSG youtube@$VER" + fi + if [ -d "version-catalogs/version-catalog-phoneui" ]; then + VER=$(grep 'metacto-phoneui = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + COMMIT_MSG="$COMMIT_MSG phone-ui@$VER" + fi + if [ -d "version-catalogs/version-catalog-imagepicker" ]; then + VER=$(grep 'metacto-imagepicker = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + COMMIT_MSG="$COMMIT_MSG image-picker@$VER" + fi + + git commit -m "$COMMIT_MSG" || echo "No changes to commit" git push From fee4218c322496ab98e5a72e61819c06289c63c9 Mon Sep 17 00:00:00 2001 From: Mahmoud Elshamy Date: Mon, 29 Dec 2025 20:58:58 +0400 Subject: [PATCH 05/12] Trigger build --- .../com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/youtube/src/androidMain/kotlin/com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt b/ui/youtube/src/androidMain/kotlin/com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt index e9e46799..b92dfa5a 100644 --- a/ui/youtube/src/androidMain/kotlin/com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt +++ b/ui/youtube/src/androidMain/kotlin/com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt @@ -140,4 +140,4 @@ actual fun YouTubePlayer( player?.pause() } ) -} \ No newline at end of file +} From db33ff6b915cdc8367cf8b1186adbc65ad5b6df2 Mon Sep 17 00:00:00 2001 From: Mahmoud Elshamy Date: Mon, 29 Dec 2025 21:12:34 +0400 Subject: [PATCH 06/12] Query GitHub Packages for latest version before publishing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use gh api to query /orgs/Meta-CTO/packages/maven/{package}/versions - Get latest published version and increment from that - Falls back to libs.versions.toml if package not found - Adds validation to fail if version parsing fails This fixes version conflicts when multiple modules change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .github/workflows/deployNewCore.yml | 255 ++++++++++++++++++++++++---- 1 file changed, 220 insertions(+), 35 deletions(-) diff --git a/.github/workflows/deployNewCore.yml b/.github/workflows/deployNewCore.yml index 544fa157..cb83d124 100644 --- a/.github/workflows/deployNewCore.yml +++ b/.github/workflows/deployNewCore.yml @@ -13,6 +13,7 @@ on: env: VERSION_SUFFIX: "-alpha" + MAVEN_REPO: "https://maven.pkg.github.com/Meta-CTO/coreapp" jobs: # ============================================ @@ -120,20 +121,42 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate next version + - name: Get latest version from Maven id: version + env: + GH_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | - # Read current version from libs.versions.toml - CURRENT_VERSION=$(grep 'metacto-core = "' gradle/libs.versions.toml | head -1 | sed 's/.*= "\([^"]*\)".*/\1/') - echo "Current version: $CURRENT_VERSION" + # Query GitHub Packages API for latest version + PACKAGE_NAME="com.metacto.kmm.core" + + # Get versions from GitHub Packages + VERSIONS=$(gh api /orgs/Meta-CTO/packages/maven/$PACKAGE_NAME/versions --jq '.[].name' 2>/dev/null || echo "") - # Parse version components (e.g., 0.2.81-alpha -> 0.2.82-alpha) - VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') # 0.2.81 + if [ -z "$VERSIONS" ]; then + # No versions found, start with base version from catalog + CURRENT_VERSION=$(grep 'metacto-core = "' gradle/libs.versions.toml | head -1 | sed 's/.*= "\([^"]*\)".*/\1/') + echo "No published versions found, using catalog version: $CURRENT_VERSION" + else + # Get the latest alpha version + CURRENT_VERSION=$(echo "$VERSIONS" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-alpha$' | sort -V | tail -1) + if [ -z "$CURRENT_VERSION" ]; then + CURRENT_VERSION=$(grep 'metacto-core = "' gradle/libs.versions.toml | head -1 | sed 's/.*= "\([^"]*\)".*/\1/') + fi + echo "Latest published version: $CURRENT_VERSION" + fi + + # Parse and increment version + VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) - # Increment patch + # Validate parsing + if [ -z "$PATCH" ]; then + echo "ERROR: Failed to parse version. CURRENT_VERSION=$CURRENT_VERSION" + exit 1 + fi + NEW_PATCH=$((PATCH + 1)) NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" @@ -195,17 +218,35 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate next version + - name: Get latest version from Maven id: version + env: + GH_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | - CURRENT_VERSION=$(grep 'metacto-coreui = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') - echo "Current version: $CURRENT_VERSION" + PACKAGE_NAME="com.metacto.kmm.core-ui" + VERSIONS=$(gh api /orgs/Meta-CTO/packages/maven/$PACKAGE_NAME/versions --jq '.[].name' 2>/dev/null || echo "") + + if [ -z "$VERSIONS" ]; then + CURRENT_VERSION=$(grep 'metacto-coreui = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "No published versions found, using catalog version: $CURRENT_VERSION" + else + CURRENT_VERSION=$(echo "$VERSIONS" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-alpha$' | sort -V | tail -1) + if [ -z "$CURRENT_VERSION" ]; then + CURRENT_VERSION=$(grep 'metacto-coreui = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + fi + echo "Latest published version: $CURRENT_VERSION" + fi VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + if [ -z "$PATCH" ]; then + echo "ERROR: Failed to parse version. CURRENT_VERSION=$CURRENT_VERSION" + exit 1 + fi + NEW_PATCH=$((PATCH + 1)) NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" @@ -267,17 +308,35 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate next version + - name: Get latest version from Maven id: version + env: + GH_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | - CURRENT_VERSION=$(grep 'metacto-files = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') - echo "Current version: $CURRENT_VERSION" + PACKAGE_NAME="com.metacto.kmm.files" + VERSIONS=$(gh api /orgs/Meta-CTO/packages/maven/$PACKAGE_NAME/versions --jq '.[].name' 2>/dev/null || echo "") + + if [ -z "$VERSIONS" ]; then + CURRENT_VERSION=$(grep 'metacto-files = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "No published versions found, using catalog version: $CURRENT_VERSION" + else + CURRENT_VERSION=$(echo "$VERSIONS" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-alpha$' | sort -V | tail -1) + if [ -z "$CURRENT_VERSION" ]; then + CURRENT_VERSION=$(grep 'metacto-files = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + fi + echo "Latest published version: $CURRENT_VERSION" + fi VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + if [ -z "$PATCH" ]; then + echo "ERROR: Failed to parse version. CURRENT_VERSION=$CURRENT_VERSION" + exit 1 + fi + NEW_PATCH=$((PATCH + 1)) NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" @@ -339,17 +398,35 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate next version + - name: Get latest version from Maven id: version + env: + GH_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | - CURRENT_VERSION=$(grep 'metacto-notifications = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') - echo "Current version: $CURRENT_VERSION" + PACKAGE_NAME="com.metacto.kmm.notifications" + VERSIONS=$(gh api /orgs/Meta-CTO/packages/maven/$PACKAGE_NAME/versions --jq '.[].name' 2>/dev/null || echo "") + + if [ -z "$VERSIONS" ]; then + CURRENT_VERSION=$(grep 'metacto-notifications = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "No published versions found, using catalog version: $CURRENT_VERSION" + else + CURRENT_VERSION=$(echo "$VERSIONS" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-alpha$' | sort -V | tail -1) + if [ -z "$CURRENT_VERSION" ]; then + CURRENT_VERSION=$(grep 'metacto-notifications = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + fi + echo "Latest published version: $CURRENT_VERSION" + fi VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + if [ -z "$PATCH" ]; then + echo "ERROR: Failed to parse version. CURRENT_VERSION=$CURRENT_VERSION" + exit 1 + fi + NEW_PATCH=$((PATCH + 1)) NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" @@ -411,17 +488,35 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate next version + - name: Get latest version from Maven id: version + env: + GH_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | - CURRENT_VERSION=$(grep 'metacto-phonecore = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') - echo "Current version: $CURRENT_VERSION" + PACKAGE_NAME="com.metacto.kmm.phone-core" + VERSIONS=$(gh api /orgs/Meta-CTO/packages/maven/$PACKAGE_NAME/versions --jq '.[].name' 2>/dev/null || echo "") + + if [ -z "$VERSIONS" ]; then + CURRENT_VERSION=$(grep 'metacto-phonecore = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "No published versions found, using catalog version: $CURRENT_VERSION" + else + CURRENT_VERSION=$(echo "$VERSIONS" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-alpha$' | sort -V | tail -1) + if [ -z "$CURRENT_VERSION" ]; then + CURRENT_VERSION=$(grep 'metacto-phonecore = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + fi + echo "Latest published version: $CURRENT_VERSION" + fi VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + if [ -z "$PATCH" ]; then + echo "ERROR: Failed to parse version. CURRENT_VERSION=$CURRENT_VERSION" + exit 1 + fi + NEW_PATCH=$((PATCH + 1)) NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" @@ -483,17 +578,35 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate next version + - name: Get latest version from Maven id: version + env: + GH_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | - CURRENT_VERSION=$(grep 'metacto-camera = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') - echo "Current version: $CURRENT_VERSION" + PACKAGE_NAME="com.metacto.kmm.camera" + VERSIONS=$(gh api /orgs/Meta-CTO/packages/maven/$PACKAGE_NAME/versions --jq '.[].name' 2>/dev/null || echo "") + + if [ -z "$VERSIONS" ]; then + CURRENT_VERSION=$(grep 'metacto-camera = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "No published versions found, using catalog version: $CURRENT_VERSION" + else + CURRENT_VERSION=$(echo "$VERSIONS" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-alpha$' | sort -V | tail -1) + if [ -z "$CURRENT_VERSION" ]; then + CURRENT_VERSION=$(grep 'metacto-camera = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + fi + echo "Latest published version: $CURRENT_VERSION" + fi VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + if [ -z "$PATCH" ]; then + echo "ERROR: Failed to parse version. CURRENT_VERSION=$CURRENT_VERSION" + exit 1 + fi + NEW_PATCH=$((PATCH + 1)) NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" @@ -555,17 +668,35 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate next version + - name: Get latest version from Maven id: version + env: + GH_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | - CURRENT_VERSION=$(grep 'metacto-mediaplayers = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') - echo "Current version: $CURRENT_VERSION" + PACKAGE_NAME="com.metacto.kmm.media-players" + VERSIONS=$(gh api /orgs/Meta-CTO/packages/maven/$PACKAGE_NAME/versions --jq '.[].name' 2>/dev/null || echo "") + + if [ -z "$VERSIONS" ]; then + CURRENT_VERSION=$(grep 'metacto-mediaplayers = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "No published versions found, using catalog version: $CURRENT_VERSION" + else + CURRENT_VERSION=$(echo "$VERSIONS" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-alpha$' | sort -V | tail -1) + if [ -z "$CURRENT_VERSION" ]; then + CURRENT_VERSION=$(grep 'metacto-mediaplayers = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + fi + echo "Latest published version: $CURRENT_VERSION" + fi VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + if [ -z "$PATCH" ]; then + echo "ERROR: Failed to parse version. CURRENT_VERSION=$CURRENT_VERSION" + exit 1 + fi + NEW_PATCH=$((PATCH + 1)) NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" @@ -627,17 +758,35 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate next version + - name: Get latest version from Maven id: version + env: + GH_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | - CURRENT_VERSION=$(grep 'metacto-youtube = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') - echo "Current version: $CURRENT_VERSION" + PACKAGE_NAME="com.metacto.kmm.youtube" + VERSIONS=$(gh api /orgs/Meta-CTO/packages/maven/$PACKAGE_NAME/versions --jq '.[].name' 2>/dev/null || echo "") + + if [ -z "$VERSIONS" ]; then + CURRENT_VERSION=$(grep 'metacto-youtube = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "No published versions found, using catalog version: $CURRENT_VERSION" + else + CURRENT_VERSION=$(echo "$VERSIONS" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-alpha$' | sort -V | tail -1) + if [ -z "$CURRENT_VERSION" ]; then + CURRENT_VERSION=$(grep 'metacto-youtube = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + fi + echo "Latest published version: $CURRENT_VERSION" + fi VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + if [ -z "$PATCH" ]; then + echo "ERROR: Failed to parse version. CURRENT_VERSION=$CURRENT_VERSION" + exit 1 + fi + NEW_PATCH=$((PATCH + 1)) NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" @@ -699,17 +848,35 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate next version + - name: Get latest version from Maven id: version + env: + GH_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | - CURRENT_VERSION=$(grep 'metacto-phoneui = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') - echo "Current version: $CURRENT_VERSION" + PACKAGE_NAME="com.metacto.kmm.phone-ui" + VERSIONS=$(gh api /orgs/Meta-CTO/packages/maven/$PACKAGE_NAME/versions --jq '.[].name' 2>/dev/null || echo "") + + if [ -z "$VERSIONS" ]; then + CURRENT_VERSION=$(grep 'metacto-phoneui = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "No published versions found, using catalog version: $CURRENT_VERSION" + else + CURRENT_VERSION=$(echo "$VERSIONS" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-alpha$' | sort -V | tail -1) + if [ -z "$CURRENT_VERSION" ]; then + CURRENT_VERSION=$(grep 'metacto-phoneui = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + fi + echo "Latest published version: $CURRENT_VERSION" + fi VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + if [ -z "$PATCH" ]; then + echo "ERROR: Failed to parse version. CURRENT_VERSION=$CURRENT_VERSION" + exit 1 + fi + NEW_PATCH=$((PATCH + 1)) NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" @@ -771,17 +938,35 @@ jobs: key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }} restore-keys: | ${{ runner.os }}-konan- - - name: Calculate next version + - name: Get latest version from Maven id: version + env: + GH_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | - CURRENT_VERSION=$(grep 'metacto-imagepicker = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') - echo "Current version: $CURRENT_VERSION" + PACKAGE_NAME="com.metacto.kmm.image-picker" + VERSIONS=$(gh api /orgs/Meta-CTO/packages/maven/$PACKAGE_NAME/versions --jq '.[].name' 2>/dev/null || echo "") + + if [ -z "$VERSIONS" ]; then + CURRENT_VERSION=$(grep 'metacto-imagepicker = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + echo "No published versions found, using catalog version: $CURRENT_VERSION" + else + CURRENT_VERSION=$(echo "$VERSIONS" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-alpha$' | sort -V | tail -1) + if [ -z "$CURRENT_VERSION" ]; then + CURRENT_VERSION=$(grep 'metacto-imagepicker = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + fi + echo "Latest published version: $CURRENT_VERSION" + fi VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + if [ -z "$PATCH" ]; then + echo "ERROR: Failed to parse version. CURRENT_VERSION=$CURRENT_VERSION" + exit 1 + fi + NEW_PATCH=$((PATCH + 1)) NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}${{ env.VERSION_SUFFIX }}" @@ -913,7 +1098,7 @@ jobs: COMMIT_MSG="Update module versions:" if [ -d "version-catalogs/version-catalog-core" ]; then - VER=$(grep 'metacto-core = "' gradle/libs.versions.toml | sed 's/.*= "\([^"]*\)".*/\1/') + VER=$(grep 'metacto-core = "' gradle/libs.versions.toml | head -1 | sed 's/.*= "\([^"]*\)".*/\1/') COMMIT_MSG="$COMMIT_MSG core@$VER" fi if [ -d "version-catalogs/version-catalog-coreui" ]; then From f1dbd94a6a794ea806063873cb23b72ee50e9a73 Mon Sep 17 00:00:00 2001 From: Mahmoud Elshamy Date: Mon, 29 Dec 2025 21:20:05 +0400 Subject: [PATCH 07/12] Trigger build --- .../com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/youtube/src/androidMain/kotlin/com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt b/ui/youtube/src/androidMain/kotlin/com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt index b92dfa5a..e9e46799 100644 --- a/ui/youtube/src/androidMain/kotlin/com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt +++ b/ui/youtube/src/androidMain/kotlin/com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt @@ -140,4 +140,4 @@ actual fun YouTubePlayer( player?.pause() } ) -} +} \ No newline at end of file From f7adc64dc3d00af9f320eb9cafeb4a78beb5ff3e Mon Sep 17 00:00:00 2001 From: Mahmoud Elshamy Date: Mon, 29 Dec 2025 21:34:08 +0400 Subject: [PATCH 08/12] Fix: Write version to versions.properties instead of local.properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gradle modules read PUBLISH_CORE_VERSION from versions.properties, not local.properties. This was causing 409 Conflict errors because the stale version in versions.properties was being used instead of the calculated new version. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .github/workflows/deployNewCore.yml | 44 +++++++++++++++-------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/.github/workflows/deployNewCore.yml b/.github/workflows/deployNewCore.yml index cb83d124..690fea1e 100644 --- a/.github/workflows/deployNewCore.yml +++ b/.github/workflows/deployNewCore.yml @@ -162,14 +162,16 @@ jobs: echo "New version: $NEW_VERSION" echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - - name: Update local properties + - name: Update properties files env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | + # Update local.properties for credentials echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties - echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + # Update versions.properties - this is what Gradle reads for the actual version + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" > ./versions.properties - name: Update version in catalog run: ./gradlew updateVersionCatalog_core -PmoduleVersion=${{ steps.version.outputs.version }} - name: Publish core module @@ -252,14 +254,14 @@ jobs: echo "New version: $NEW_VERSION" echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - - name: Update local properties + - name: Update properties files env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties - echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" > ./versions.properties - name: Update version in catalog run: ./gradlew updateVersionCatalog_coreui -PmoduleVersion=${{ steps.version.outputs.version }} - name: Publish core-ui module @@ -342,14 +344,14 @@ jobs: echo "New version: $NEW_VERSION" echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - - name: Update local properties + - name: Update properties files env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties - echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" > ./versions.properties - name: Update version in catalog run: ./gradlew updateVersionCatalog_files -PmoduleVersion=${{ steps.version.outputs.version }} - name: Publish files module @@ -432,14 +434,14 @@ jobs: echo "New version: $NEW_VERSION" echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - - name: Update local properties + - name: Update properties files env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties - echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" > ./versions.properties - name: Update version in catalog run: ./gradlew updateVersionCatalog_notifications -PmoduleVersion=${{ steps.version.outputs.version }} - name: Publish notifications module @@ -522,14 +524,14 @@ jobs: echo "New version: $NEW_VERSION" echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - - name: Update local properties + - name: Update properties files env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties - echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" > ./versions.properties - name: Update version in catalog run: ./gradlew updateVersionCatalog_phonecore -PmoduleVersion=${{ steps.version.outputs.version }} - name: Publish phone-core module @@ -612,14 +614,14 @@ jobs: echo "New version: $NEW_VERSION" echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - - name: Update local properties + - name: Update properties files env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties - echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" > ./versions.properties - name: Update version in catalog run: ./gradlew updateVersionCatalog_camera -PmoduleVersion=${{ steps.version.outputs.version }} - name: Publish camera module @@ -702,14 +704,14 @@ jobs: echo "New version: $NEW_VERSION" echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - - name: Update local properties + - name: Update properties files env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties - echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" > ./versions.properties - name: Update version in catalog run: ./gradlew updateVersionCatalog_mediaplayers -PmoduleVersion=${{ steps.version.outputs.version }} - name: Publish media-players module @@ -792,14 +794,14 @@ jobs: echo "New version: $NEW_VERSION" echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - - name: Update local properties + - name: Update properties files env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties - echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" > ./versions.properties - name: Update version in catalog run: ./gradlew updateVersionCatalog_youtube -PmoduleVersion=${{ steps.version.outputs.version }} - name: Publish youtube module @@ -882,14 +884,14 @@ jobs: echo "New version: $NEW_VERSION" echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - - name: Update local properties + - name: Update properties files env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties - echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" > ./versions.properties - name: Update version in catalog run: ./gradlew updateVersionCatalog_phoneui -PmoduleVersion=${{ steps.version.outputs.version }} - name: Publish phone-ui module @@ -972,14 +974,14 @@ jobs: echo "New version: $NEW_VERSION" echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - - name: Update local properties + - name: Update properties files env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} run: | echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties - echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" >> ./local.properties + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" > ./versions.properties - name: Update version in catalog run: ./gradlew updateVersionCatalog_imagepicker -PmoduleVersion=${{ steps.version.outputs.version }} - name: Publish image-picker module @@ -1077,7 +1079,7 @@ jobs: echo "Updated version catalog:" head -30 gradle/libs.versions.toml - - name: Update local properties + - name: Update properties files env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} PUBLISH_REPO_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} From a960aa64f61e7ca1f9afa43cb9124c4ccebf0e7a Mon Sep 17 00:00:00 2001 From: Mahmoud Elshamy Date: Mon, 29 Dec 2025 21:35:25 +0400 Subject: [PATCH 09/12] Trigger build --- .../com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/youtube/src/androidMain/kotlin/com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt b/ui/youtube/src/androidMain/kotlin/com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt index e9e46799..b92dfa5a 100644 --- a/ui/youtube/src/androidMain/kotlin/com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt +++ b/ui/youtube/src/androidMain/kotlin/com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt @@ -140,4 +140,4 @@ actual fun YouTubePlayer( player?.pause() } ) -} \ No newline at end of file +} From 8888d7f179f57ddc42d2636694501837f962b9a5 Mon Sep 17 00:00:00 2001 From: Mahmoud Elshamy Date: Mon, 29 Dec 2025 22:09:45 +0400 Subject: [PATCH 10/12] Fix: Add version calculation for version-catalog publish job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The version-catalog module also reads from versions.properties. Added GitHub Packages API query to get latest version and increment it, then write to versions.properties before publishing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .github/workflows/deployNewCore.yml | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/deployNewCore.yml b/.github/workflows/deployNewCore.yml index 690fea1e..ae528f7f 100644 --- a/.github/workflows/deployNewCore.yml +++ b/.github/workflows/deployNewCore.yml @@ -1079,6 +1079,34 @@ jobs: echo "Updated version catalog:" head -30 gradle/libs.versions.toml + - name: Get latest version-catalog version from Maven + id: version + env: + GH_TOKEN: ${{ secrets.PUBLISH_REPO_TOKEN }} + run: | + PACKAGE_NAME="com.metacto.kmm.version-catalog" + VERSIONS=$(gh api /orgs/Meta-CTO/packages/maven/$PACKAGE_NAME/versions --jq '.[].name' 2>/dev/null || echo "") + + if [ -z "$VERSIONS" ]; then + CURRENT_VERSION="0.2.82-alpha" + echo "No published versions found, using default: $CURRENT_VERSION" + else + CURRENT_VERSION=$(echo "$VERSIONS" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-alpha$' | sort -V | tail -1) + if [ -z "$CURRENT_VERSION" ]; then + CURRENT_VERSION="0.2.82-alpha" + fi + echo "Latest published version: $CURRENT_VERSION" + fi + + VERSION_BASE=$(echo "$CURRENT_VERSION" | sed 's/-[^-]*$//') + MAJOR=$(echo "$VERSION_BASE" | cut -d. -f1) + MINOR=$(echo "$VERSION_BASE" | cut -d. -f2) + PATCH=$(echo "$VERSION_BASE" | cut -d. -f3) + NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))-alpha" + + echo "New version: $NEW_VERSION" + echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT + - name: Update properties files env: PUBLISH_REPO_USER: ${{ secrets.PUBLISH_REPO_USER }} @@ -1086,6 +1114,8 @@ jobs: run: | echo "PUBLISH_REPO_USER=$PUBLISH_REPO_USER" > ./local.properties echo "PUBLISH_REPO_TOKEN=$PUBLISH_REPO_TOKEN" >> ./local.properties + # Update versions.properties - this is what Gradle reads for the actual version + echo "PUBLISH_CORE_VERSION=${{ steps.version.outputs.version }}" > ./versions.properties - name: Publish version catalog run: ./gradlew :version-catalog:publishAllPublicationsToGithubRepository From d192018e61aa085a9593c8796b02f2ea727c2331 Mon Sep 17 00:00:00 2001 From: Mahmoud Elshamy Date: Mon, 29 Dec 2025 22:13:37 +0400 Subject: [PATCH 11/12] Trigger build --- .../com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/youtube/src/androidMain/kotlin/com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt b/ui/youtube/src/androidMain/kotlin/com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt index b92dfa5a..e9e46799 100644 --- a/ui/youtube/src/androidMain/kotlin/com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt +++ b/ui/youtube/src/androidMain/kotlin/com/metacto/core/ui/youtube/player/YouTubePlayer.android.kt @@ -140,4 +140,4 @@ actual fun YouTubePlayer( player?.pause() } ) -} +} \ No newline at end of file From 5245288cbda3944970704c6a959e8d8f7e5b62e5 Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot Date: Mon, 29 Dec 2025 18:23:54 +0000 Subject: [PATCH 12/12] Update module versions: youtube@0.2.83-alpha --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d1cd448b..6ca7806e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -20,7 +20,7 @@ metacto-notifications = "0.2.82-alpha" metacto-phonecore = "0.2.82-alpha" metacto-camera = "0.2.82-alpha" metacto-mediaplayers = "0.2.82-alpha" -metacto-youtube = "0.2.82-alpha" +metacto-youtube = "0.2.83-alpha" metacto-phoneui = "0.2.82-alpha" metacto-imagepicker = "0.2.82-alpha" metacto-inspektify = "1.0.0-beta09-meta-2"