Skip to content

Commit feb7840

Browse files
authored
Merge pull request #211 from immutable/feat/track-unity-sdk-version
feat: [DX-2896] Track Unity SDK version
2 parents 9bdb0c1 + 09f2baa commit feb7840

File tree

9 files changed

+56
-6
lines changed

9 files changed

+56
-6
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
USER=$1
4+
TOKEN=$2
5+
6+
response=$(curl -s -H "Authorization: token $TOKEN" "https://api.github.com/orgs/immutable/teams/sdk/memberships/$USER")
7+
8+
if echo "$response" | grep -q '"state": "active"'; then
9+
echo "true"
10+
else
11+
echo "false"
12+
fi

.github/workflows/linter.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,4 @@ jobs:
6161
VALIDATE_MARKDOWN: false
6262
VALIDATE_GITLEAKS: false
6363
VALIDATE_JSCPD: false
64+
VALIDATE_SHELL_SHFMT: false

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
- name: Get the latest tag
2222
run: |
2323
git fetch --tags
24-
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
25-
echo "LATEST_TAG=${LATEST_TAG}" >> $GITHUB_ENV
24+
LATEST_TAG="$(git describe --tags "$(git rev-list --tags --max-count=1)")"
25+
echo "LATEST_TAG=${LATEST_TAG}" >> "$GITHUB_ENV"
2626
2727
- name: Pull LFS
2828
run: git lfs pull

.github/workflows/tag.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
id: extract_version
2727
run: |
2828
VERSION=$(jq -r .version ./src/Packages/Passport/package.json)
29-
echo "VERSION=$VERSION" >> $GITHUB_ENV
29+
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
3030
3131
- name: Create Tag
3232
uses: negz/create-tag@v1

.github/workflows/update-version.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@ on:
1010

1111
jobs:
1212
update:
13-
if: contains('["nattb8"]', github.actor)
1413
runs-on: ubuntu-latest
15-
1614
steps:
15+
- name: Check team membership
16+
id: check_team
17+
run: |
18+
IS_MEMBER=$(./.github/scripts/check_team_membership.sh "${{ github.actor }}" "${{ secrets.GITHUB_TOKEN }}")
19+
if [[ "$IS_MEMBER" != "true" ]]; then
20+
echo "Not a member of the SDK team, skipping update"
21+
exit 1
22+
fi
23+
1724
- name: Checkout code
1825
uses: actions/checkout@v3
1926

@@ -30,7 +37,14 @@ jobs:
3037
run: |
3138
FILE=./src/Packages/Passport/package.json
3239
VERSION=${{ github.event.inputs.version }}
33-
jq --arg version "$VERSION" '.version = $version' "./src/Packages/Passport/package.json" > tmp.$$.json && mv tmp.$$.json "./src/Packages/Passport/package.json"
40+
jq --arg version "$VERSION" '.version = $version' $FILE > tmp.$$.json && mv tmp.$$.json $FILE
41+
42+
- name: Replace engine sdk version string
43+
id: replace_engine_sdk_version
44+
run: |
45+
FILE=./src/Packages/Passport/Runtime/Scripts/Private/Helpers/SdkVersionInfoHelpers.cs
46+
VERSION=${{ github.event.inputs.version }}
47+
sed -i -E "s/[0-9]+\.[0-9]+\.[0-9]+/$VERSION/g" $FILE
3448
3549
- uses: gr2m/create-or-update-pull-request-action@v1
3650
env:
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace Immutable.Passport.Helpers
2+
{
3+
public class SdkVersionInfoHelpers
4+
{
5+
public static string GetSdkVersionInfo()
6+
{
7+
return "1.16.6";
8+
}
9+
}
10+
}

src/Packages/Passport/Runtime/Scripts/Private/Helpers/SdkVersionInfoHelpers.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Packages/Passport/Runtime/Scripts/Private/Model/Request/VersionInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ public class VersionInfo
77
{
88
public string engine;
99
public string engineVersion;
10+
public string engineSdkVersion;
1011
public string platform;
1112
public string platformVersion;
1213
public string deviceModel;

src/Packages/Passport/Runtime/Scripts/Private/PassportImpl.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public async UniTask Init(string clientId, string environment, string redirectUr
6060
{
6161
engine = "unity",
6262
engineVersion = Application.unityVersion,
63+
engineSdkVersion = SdkVersionInfoHelpers.GetSdkVersionInfo(),
6364
platform = Application.platform.ToString(),
6465
platformVersion = SystemInfo.operatingSystem,
6566
deviceModel = SystemInfo.deviceModel

0 commit comments

Comments
 (0)