-
Notifications
You must be signed in to change notification settings - Fork 7
116 lines (97 loc) · 4.18 KB
/
create_release.yml
File metadata and controls
116 lines (97 loc) · 4.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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