SDK Releaser #41
Workflow file for this run
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: SDK Releaser | |
| on: | |
| release: | |
| types: [created] | |
| # push: | |
| # tags: | |
| # - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| tag_name: | |
| description: "Tag name for release (e.g., v3.8.4)" | |
| required: true | |
| type: string | |
| jobs: | |
| build-android: | |
| runs-on: ubuntu-latest | |
| env: | |
| TAG_VERSION: ${{ github.event.inputs.tag_name || github.ref_name }} | |
| PROJECT_NAME: ${{ github.event.repository.name }} | |
| NDK_VERSION: "20.1.5948944" # NDK r20b | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.tag_name || github.ref }} | |
| - name: Create version file | |
| run: | | |
| mkdir -p version | |
| echo -n "${{ env.TAG_VERSION }}" > version/version | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.24" | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Install NDK r20b | |
| run: | | |
| echo "Installing NDK r20b (version $NDK_VERSION)..." | |
| $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "ndk;$NDK_VERSION" | |
| echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/$NDK_VERSION" >> $GITHUB_ENV | |
| echo "NDK_ROOT=$ANDROID_HOME/ndk/$NDK_VERSION" >> $GITHUB_ENV | |
| if [ -d "$ANDROID_HOME/ndk/$NDK_VERSION" ]; then | |
| echo "NDK r20b installed successfully" | |
| ls -la $ANDROID_HOME/ndk/$NDK_VERSION | |
| else | |
| echo "NDK installation failed" | |
| exit 1 | |
| fi | |
| - name: Install gomobile | |
| run: | | |
| go install golang.org/x/mobile/cmd/gomobile@latest | |
| go install golang.org/x/mobile/cmd/gobind@latest | |
| # gomobile init | |
| - name: Build Android AAR using Makefile | |
| run: | | |
| export ANDROID_NDK_HOME=$ANDROID_HOME/ndk/$NDK_VERSION | |
| export NDK_ROOT=$ANDROID_HOME/ndk/$NDK_VERSION | |
| echo "Using NDK r20b: $ANDROID_NDK_HOME" | |
| echo "Building Android AAR using make android..." | |
| make android | |
| - name: Create Android archive | |
| run: | | |
| archive_name="${PROJECT_NAME}_${TAG_VERSION}_Android_aar.zip" | |
| zip $archive_name open_im_sdk.aar | |
| echo "Created archive: $archive_name" | |
| - name: Upload Android AAR to Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') || github.event.inputs.tag_name | |
| with: | |
| tag_name: ${{ github.event.inputs.tag_name || github.ref_name }} | |
| files: ${{ env.PROJECT_NAME }}_${{ env.TAG_VERSION }}_Android_aar.zip | |
| draft: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-ios: | |
| runs-on: macos-latest | |
| env: | |
| TAG_VERSION: ${{ github.event.inputs.tag_name || github.ref_name }} | |
| PROJECT_NAME: ${{ github.event.repository.name }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.tag_name || github.ref }} | |
| - name: Create version file | |
| run: | | |
| mkdir -p version | |
| echo -n "${{ env.TAG_VERSION }}" > version/version | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: "1.24" | |
| - name: Install gomobile | |
| run: | | |
| go install golang.org/x/mobile/cmd/gomobile@latest | |
| go install golang.org/x/mobile/cmd/gobind@latest | |
| gomobile init | |
| - name: Build iOS xcframework | |
| run: | | |
| # gomobile bind -v -trimpath -ldflags="-s -w" \ | |
| # -o ./build/OpenIMCore.xcframework -target=ios \ | |
| # ./open_im_sdk/ ./open_im_sdk_callback/ | |
| make ios | |
| - name: Create iOS archive | |
| run: | | |
| cd build | |
| archive_name="${PROJECT_NAME}_${TAG_VERSION}_iOS_xcframework.zip" | |
| zip -r ../$archive_name OpenIMCore.xcframework | |
| echo "Created archive: $archive_name" | |
| - name: Upload iOS xcframework to Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') || github.event.inputs.tag_name | |
| with: | |
| tag_name: ${{ github.event.inputs.tag_name || github.ref_name }} | |
| files: ${{ env.PROJECT_NAME }}_${{ env.TAG_VERSION }}_iOS_xcframework.zip | |
| draft: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-wasm: | |
| runs-on: ubuntu-latest | |
| env: | |
| TAG_VERSION: ${{ github.event.inputs.tag_name || github.ref_name }} | |
| PROJECT_NAME: ${{ github.event.repository.name }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.tag_name || github.ref }} | |
| - name: Create version file | |
| run: | | |
| mkdir -p version | |
| echo -n "${{ env.TAG_VERSION }}" > version/version | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.24" | |
| - name: Install make and zip | |
| run: sudo apt-get update && sudo apt-get install -y make zip | |
| - name: Build WASM | |
| run: | | |
| cd wasm/cmd | |
| make wasm | |
| make static/wasm_exec.js | |
| - name: Create WASM archive | |
| run: | | |
| cd wasm/cmd | |
| archive_name="${PROJECT_NAME}_${TAG_VERSION}_JS_wasm.zip" | |
| zip -r $archive_name openIM.wasm static/ | |
| echo "Created archive: $archive_name" | |
| - name: Upload WASM files to Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') || github.event.inputs.tag_name | |
| with: | |
| tag_name: ${{ github.event.inputs.tag_name || github.ref_name }} | |
| files: wasm/cmd/${{ env.PROJECT_NAME }}_${{ env.TAG_VERSION }}_JS_wasm.zip | |
| draft: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |