C++ SDK Release v5.2.0 #12
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: Create Release | |
| run-name: C++ SDK Release ${{ inputs.tag_name }} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag_name: | |
| description: 'Tag name for the release (e.g., v1.0.0)' | |
| required: true | |
| type: string | |
| jobs: | |
| build: | |
| uses: ./.github/workflows/cmake.yml | |
| with: | |
| build_type: '"Release"' | |
| upload_artifacts: true | |
| release: | |
| name: Create GitHub Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # Fetch all history for tags and commits | |
| - name: Set up Git credentials | |
| run: | | |
| git config user.name "ga-sdk-release[bot]" | |
| git config user.email "ga-sdk-release[bot]@noreply.gameanalytics.com" | |
| - name: Push tag ${{ inputs.tag_name }} | |
| run: | | |
| git tag ${{ inputs.tag_name }} | |
| git push origin ${{ inputs.tag_name }} | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./release-artifacts | |
| - name: Organize release files | |
| run: | | |
| # Create separate directories for static and shared libraries | |
| mkdir -p ./static-release/include | |
| mkdir -p ./shared-release/include | |
| # Copy include directory from any artifact (they're all identical) | |
| FIRST_ARTIFACT=$(find ./release-artifacts -mindepth 1 -maxdepth 1 -type d | head -n 1) | |
| cp -r $FIRST_ARTIFACT/include/* ./static-release/include/ | |
| cp -r $FIRST_ARTIFACT/include/* ./shared-release/include/ | |
| # Copy GameAnalyticsExtern.h for shared library release | |
| cp ./source/gameanalytics/GameAnalyticsExtern.h ./shared-release/include/GameAnalytics/ | |
| # Process static library artifacts | |
| for artifact_dir in ./release-artifacts/*-static; do | |
| artifact_name=$(basename $artifact_dir) | |
| # Extract platform info (remove ga-cpp-sdk- prefix and -static suffix) | |
| platform_info=${artifact_name#ga-cpp-sdk-} | |
| platform_info=${platform_info%-static} | |
| mkdir -p ./static-release/$platform_info | |
| # Copy static libraries | |
| if [[ $artifact_name == *"windows"* ]]; then | |
| cp $artifact_dir/*.lib ./static-release/$platform_info/ 2>/dev/null || true | |
| else | |
| cp $artifact_dir/*.a ./static-release/$platform_info/ 2>/dev/null || true | |
| fi | |
| done | |
| # Process shared library artifacts | |
| for artifact_dir in ./release-artifacts/*-shared; do | |
| artifact_name=$(basename $artifact_dir) | |
| # Extract platform info (remove ga-cpp-sdk- prefix and -shared suffix) | |
| platform_info=${artifact_name#ga-cpp-sdk-} | |
| platform_info=${platform_info%-shared} | |
| mkdir -p ./shared-release/$platform_info | |
| # Copy shared libraries | |
| if [[ $artifact_name == *"windows"* ]]; then | |
| cp $artifact_dir/*.dll ./shared-release/$platform_info/ 2>/dev/null || true | |
| elif [[ $artifact_name == *"macOS"* ]]; then | |
| cp $artifact_dir/*.dylib ./shared-release/$platform_info/ 2>/dev/null || true | |
| else | |
| cp $artifact_dir/*.so ./shared-release/$platform_info/ 2>/dev/null || true | |
| fi | |
| done | |
| # Create zip archives | |
| zip -r ga-sdk-static-${{ inputs.tag_name }}.zip ./static-release | |
| zip -r ga-sdk-shared-${{ inputs.tag_name }}.zip ./shared-release | |
| - name: Show organized release files | |
| run: | | |
| echo "=== Static Libraries ===" | |
| tree ./static-release || ls -R ./static-release | |
| echo "" | |
| echo "=== Shared Libraries ===" | |
| tree ./shared-release || ls -R ./shared-release | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2.0.8 | |
| with: | |
| tag_name: ${{ inputs.tag_name }} | |
| name: Release GA-CPP-SDK ${{ inputs.tag_name }} | |
| generate_release_notes: true | |
| make_latest: true | |
| files: | | |
| ga-sdk-static-${{ inputs.tag_name }}.zip | |
| ga-sdk-shared-${{ inputs.tag_name }}.zip |