fix(embedded-messaging): metaData made reactive #149
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Artifacts | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: 'Dry run — build and validate without publishing' | |
| type: boolean | |
| default: true | |
| env: | |
| DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run == true }} | |
| VERSION: 0.0.${{ github.run_number }} | |
| JAVA_VERSION: '17' | |
| JAVA_DISTRIBUTION: 'temurin' | |
| USE_LOCAL_DEPENDENCY: ${{ vars.USE_LOCAL_DEPENDENCY }} | |
| RELEASE_MODE: ${{ vars.RELEASE_MODE }} | |
| FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }} | |
| FIREBASE_SERVICE_ACCOUNT_JSON: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }} | |
| GOOGLE_OAUTH_SERVER_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_SERVER_CLIENT_ID }} | |
| GOOGLE_SERVICES_API_KEY: ${{ secrets.GOOGLE_SERVICES_API_KEY }} | |
| OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
| OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
| ANDROID_RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }} | |
| ANDROID_RELEASE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEY_ALIAS }} | |
| ANDROID_RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_RELEASE_STORE_PASSWORD }} | |
| ANDROID_RELEASE_STORE_FILE_BASE64: ${{ secrets.ANDROID_RELEASE_STORE_FILE_BASE64 }} | |
| SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} | |
| SONATYPE_SIGNING_KEY_ID: ${{ secrets.SONATYPE_SIGNING_KEY_ID }} | |
| SONATYPE_SIGNING_PASSWORD: ${{ secrets.SONATYPE_SIGNING_PASSWORD }} | |
| SONATYPE_SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SONATYPE_SIGNING_SECRET_KEY_RING_FILE }} | |
| GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }} | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
| SLACK_ICON: https://upload.wikimedia.org/wikipedia/commons/thumb/0/06/Kotlin_Icon.svg/1200px-Kotlin_Icon.svg.png | |
| DETECT_LATEST_RELEASE_VERSION: ${{ secrets.DETECT_LATEST_RELEASE_VERSION }} | |
| DETECT_PROJECT_USER_GROUPS: ${{ secrets.DETECT_PROJECT_USER_GROUPS }} | |
| DETECT_PROJECT_VERSION_DISTRIBUTION: ${{ secrets.DETECT_PROJECT_VERSION_DISTRIBUTION }} | |
| BLACKDUCK_ACCESS_TOKEN: ${{ secrets.BLACKDUCK_ACCESS_TOKEN }} | |
| BLACKDUCK_URL: ${{ secrets.BLACKDUCK_URL }} | |
| SPM_BUILD: ${{ vars.SPM_BUILD }} | |
| permissions: | |
| contents: write | |
| packages: write | |
| actions: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| android-pipeline: | |
| name: Android Pipeline (Build, Test, Publish) | |
| runs-on: macos-latest-xlarge | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ env.JAVA_VERSION }} | |
| distribution: ${{ env.JAVA_DISTRIBUTION }} | |
| - uses: gradle/actions/setup-gradle@v4 | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Run Android Pipeline (Build, Lint, Test, [Publish]) | |
| run: make pipeline-android | |
| env: | |
| PUBLISH: ${{ env.DRY_RUN != 'true' }} | |
| VERSION_OVERRIDE: ${{ env.VERSION }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| GITHUB_REPO: ${{ github.repository }} | |
| - name: Upload Android artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: android-artifacts | |
| retention-days: 1 | |
| if-no-files-found: error | |
| path: | | |
| engagement-cloud-sdk/build/outputs/aar/*-release.aar | |
| engagement-cloud-sdk-android-fcm/build/outputs/aar/*-release.aar | |
| engagement-cloud-sdk-android-hms/build/outputs/aar/*-release.aar | |
| js-pipeline: | |
| name: JS Pipeline (Build, Test, Publish) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ env.JAVA_VERSION }} | |
| distribution: ${{ env.JAVA_DISTRIBUTION }} | |
| - uses: gradle/actions/setup-gradle@v4 | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22' | |
| registry-url: 'https://npm.pkg.github.com' | |
| scope: '@emartech' | |
| - name: Install npm dependencies | |
| run: npm install | |
| - name: Install Chrome for tests | |
| run: | | |
| wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
| sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' | |
| sudo apt-get update -q | |
| sudo apt-get install -y google-chrome-stable | |
| - name: Run JS Pipeline (Build, Test) | |
| run: make pipeline-js | |
| - name: Assemble NPM package | |
| run: | | |
| mkdir -p dist/npm | |
| cp engagement-cloud-sdk/build/kotlin-webpack/js/productionExecutable/engagement-cloud-sdk-html.js dist/npm/ | |
| cp build/js/packages/engagement-cloud-sdk/kotlin/engagement-cloud-sdk-html.d.ts dist/npm/ 2>/dev/null || true | |
| sed "s/\"version\": \"0.0.0\"/\"version\": \"${{ env.VERSION }}\"/" \ | |
| engagement-cloud-sdk/npm-package.json > dist/npm/package.json | |
| - name: Publish to GitHub Packages NPM | |
| if: env.DRY_RUN != 'true' | |
| run: npm publish dist/npm/ | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Assemble Pure JS Artifacts for CDN | |
| run: | | |
| mkdir -p dist/cdn/${{ env.VERSION }} | |
| # Copy main SDK bundle | |
| cp engagement-cloud-sdk/build/kotlin-webpack/js/productionExecutable/engagement-cloud-sdk-html.js \ | |
| dist/cdn/${{ env.VERSION }}/engagement-cloud-sdk.js | |
| # Copy TypeScript definitions | |
| cp build/js/packages/engagement-cloud-sdk/kotlin/engagement-cloud-sdk-html.d.ts \ | |
| dist/cdn/${{ env.VERSION }}/engagement-cloud-sdk.d.ts 2>/dev/null || true | |
| # Copy loader script | |
| cp engagement-cloud-sdk/src/jsHtml/resources/engagement-cloud-sdk-loader.js \ | |
| dist/cdn/${{ env.VERSION }}/engagement-cloud-sdk-loader.js | |
| # Copy service worker | |
| cp web-push-service-worker/build/kotlin-webpack/js/productionExecutable/ec-service-worker.js \ | |
| dist/cdn/${{ env.VERSION }}/ec-service-worker.js | |
| # Create latest symlink content (copy same files to latest/) | |
| mkdir -p dist/cdn/latest | |
| cp dist/cdn/${{ env.VERSION }}/* dist/cdn/latest/ | |
| # Create zip for GitHub Release | |
| cd dist/cdn/${{ env.VERSION }} | |
| zip -r ../engagement-cloud-sdk-web-${{ env.VERSION }}.zip . | |
| cd - | |
| echo "CDN artifacts assembled:" | |
| ls -la dist/cdn/${{ env.VERSION }}/ | |
| ls -la dist/cdn/ | |
| - name: Deploy to GitHub Pages | |
| if: env.DRY_RUN != 'true' | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./dist/cdn | |
| keep_files: true | |
| destination_dir: . | |
| - name: Upload JS Web Bundle to GitHub Release | |
| if: env.DRY_RUN != 'true' | |
| run: | | |
| # Create release if it doesn't exist (iOS pipeline may have created it) | |
| gh release create ${{ env.VERSION }} \ | |
| --title "Release ${{ env.VERSION }}" \ | |
| --prerelease \ | |
| --generate-release-notes || true | |
| # Upload web bundle zip | |
| gh release upload ${{ env.VERSION }} \ | |
| dist/cdn/engagement-cloud-sdk-web-${{ env.VERSION }}.zip \ | |
| --clobber | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload JS artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: js-artifacts | |
| retention-days: 1 | |
| if-no-files-found: error | |
| path: | | |
| dist/npm/ | |
| dist/cdn/${{ env.VERSION }}/ | |
| ios-pipeline: | |
| name: iOS Pipeline (Build, Test, Publish) | |
| runs-on: macos-latest-xlarge | |
| env: | |
| SPM_BUILD: release | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ env.JAVA_VERSION }} | |
| distribution: ${{ env.JAVA_DISTRIBUTION }} | |
| - name: Cache Konan directory | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.konan | |
| key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle.kts', '**/libs.versions.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-konan- | |
| - uses: gradle/actions/setup-gradle@v4 | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Create GitHub Release for SPM artifact | |
| if: env.DRY_RUN != 'true' | |
| id: spm_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag_name: ${{ env.VERSION }} | |
| name: SPM Release ${{ env.VERSION }} | |
| prerelease: true | |
| generate_release_notes: false | |
| - name: Build and Test iOS | |
| run: make pipeline-ios | |
| env: | |
| PUBLISH: ${{ env.DRY_RUN != 'true' }} | |
| VERSION_OVERRIDE: ${{ env.VERSION }} | |
| - name: Upload XCFrameworks to GitHub Release | |
| if: env.DRY_RUN != 'true' | |
| run: | | |
| # Zip XCFrameworks (preserving directory structure) | |
| cd engagement-cloud-sdk/build/XCFrameworks/release | |
| zip -r $GITHUB_WORKSPACE/EngagementCloudSDK.xcframework.zip EngagementCloudSDK.xcframework | |
| cd $GITHUB_WORKSPACE | |
| cd ios-notification-service/build/XCFrameworks/release | |
| zip -r $GITHUB_WORKSPACE/EngagementCloudSDKNotificationService.xcframework.zip EngagementCloudSDKNotificationService.xcframework | |
| cd $GITHUB_WORKSPACE | |
| # Calculate checksums | |
| echo "SDK_CHECKSUM=$(shasum -a 256 EngagementCloudSDK.xcframework.zip | cut -d ' ' -f 1)" >> $GITHUB_ENV | |
| echo "NS_CHECKSUM=$(shasum -a 256 EngagementCloudSDKNotificationService.xcframework.zip | cut -d ' ' -f 1)" >> $GITHUB_ENV | |
| # Upload to GitHub Release | |
| gh release upload ${{ env.VERSION }} \ | |
| EngagementCloudSDK.xcframework.zip \ | |
| EngagementCloudSDKNotificationService.xcframework.zip \ | |
| --clobber | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Generate and commit Package.swift for SPM | |
| if: env.DRY_RUN != 'true' | |
| run: | | |
| # Generate Package.swift from template | |
| sed -e "s|__SDK_URL__|https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/EngagementCloudSDK.xcframework.zip|" \ | |
| -e "s|__SDK_CHECKSUM__|${{ env.SDK_CHECKSUM }}|" \ | |
| -e "s|__NS_URL__|https://github.com/${{ github.repository }}/releases/download/${{ env.VERSION }}/EngagementCloudSDKNotificationService.xcframework.zip|" \ | |
| -e "s|__NS_CHECKSUM__|${{ env.NS_CHECKSUM }}|" \ | |
| iosReleaseSpm/Package.swift > Package.swift | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Update main branch with latest Package.swift | |
| git add Package.swift | |
| git commit -m "Update Package.swift for SPM release ${{ env.VERSION }}" | |
| git push origin HEAD:main | |
| # Also tag this commit for SPM version resolution | |
| git tag -f ${{ env.VERSION }} | |
| git push origin ${{ env.VERSION }} --force | |
| - name: Upload iOS XCFramework artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ios-artifacts | |
| retention-days: 1 | |
| if-no-files-found: error | |
| path: | | |
| engagement-cloud-sdk/build/XCFrameworks/release/*.xcframework | |
| ios-notification-service/build/XCFrameworks/release/*.xcframework | |
| report-slack: | |
| name: Report / Slack | |
| if: always() | |
| needs: [android-pipeline, js-pipeline, ios-pipeline] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Compute Slack prefix | |
| id: prefix | |
| run: | | |
| if [ "${{ env.DRY_RUN }}" = "true" ]; then | |
| echo "value=[DRY RUN] " >> "$GITHUB_OUTPUT" | |
| else | |
| echo "value=" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Notify Slack (failure) | |
| if: ${{ !cancelled() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }} | |
| uses: 8398a7/action-slack@v3 | |
| with: | |
| status: failure | |
| channel: mobile-team-ci | |
| text: '${{ steps.prefix.outputs.value }}Publish pipeline failed! :man-gesturing-no: :blobcatfearful:' | |
| fields: repo,workflow,job,took | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ env.SLACK_WEBHOOK }} | |
| - name: Notify Slack (success) | |
| if: ${{ !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }} | |
| uses: 8398a7/action-slack@v3 | |
| with: | |
| status: success | |
| channel: mobile-team-ci | |
| text: '${{ steps.prefix.outputs.value }}Publish pipeline succeeded! v${{ env.VERSION }} :man-gesturing-ok: :bananadance:' | |
| fields: repo,workflow,job,took | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ env.SLACK_WEBHOOK }} |