Skip to content

feat: [DX-2896] Track Unity SDK version #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/scripts/check_team_membership.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

USER=$1
TOKEN=$2

response=$(curl -s -H "Authorization: token $TOKEN" "https://api.github.com/orgs/immutable/teams/sdk/memberships/$USER")

if echo "$response" | grep -q '"state": "active"'; then
echo "true"
else
echo "false"
fi
1 change: 1 addition & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ jobs:
VALIDATE_MARKDOWN: false
VALIDATE_GITLEAKS: false
VALIDATE_JSCPD: false
VALIDATE_SHELL_SHFMT: false
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- name: Get the latest tag
run: |
git fetch --tags
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "LATEST_TAG=${LATEST_TAG}" >> $GITHUB_ENV
LATEST_TAG="$(git describe --tags "$(git rev-list --tags --max-count=1)")"
echo "LATEST_TAG=${LATEST_TAG}" >> "$GITHUB_ENV"

- name: Pull LFS
run: git lfs pull
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
id: extract_version
run: |
VERSION=$(jq -r .version ./src/Packages/Passport/package.json)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> "$GITHUB_ENV"

- name: Create Tag
uses: negz/create-tag@v1
Expand Down
20 changes: 17 additions & 3 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@ on:

jobs:
update:
if: contains('["nattb8"]', github.actor)
runs-on: ubuntu-latest

steps:
- name: Check team membership
id: check_team
run: |
IS_MEMBER=$(./.github/scripts/check_team_membership.sh "${{ github.actor }}" "${{ secrets.GITHUB_TOKEN }}")
if [[ "$IS_MEMBER" != "true" ]]; then
echo "Not a member of the SDK team, skipping update"
exit 1
fi

- name: Checkout code
uses: actions/checkout@v3

Expand All @@ -30,7 +37,14 @@ jobs:
run: |
FILE=./src/Packages/Passport/package.json
VERSION=${{ github.event.inputs.version }}
jq --arg version "$VERSION" '.version = $version' "./src/Packages/Passport/package.json" > tmp.$$.json && mv tmp.$$.json "./src/Packages/Passport/package.json"
jq --arg version "$VERSION" '.version = $version' $FILE > tmp.$$.json && mv tmp.$$.json $FILE

- name: Replace engine sdk version string
id: replace_engine_sdk_version
run: |
FILE=./src/Packages/Passport/Runtime/Scripts/Private/Helpers/SdkVersionInfoHelpers.cs
VERSION=${{ github.event.inputs.version }}
sed -i -E "s/[0-9]+\.[0-9]+\.[0-9]+/$VERSION/g" $FILE

- uses: gr2m/create-or-update-pull-request-action@v1
env:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Immutable.Passport.Helpers
{
public class SdkVersionInfoHelpers
{
public static string GetSdkVersionInfo()
{
return "1.16.6";
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class VersionInfo
{
public string engine;
public string engineVersion;
public string engineSdkVersion;
public string platform;
public string platformVersion;
public string deviceModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public async UniTask Init(string clientId, string environment, string redirectUr
{
engine = "unity",
engineVersion = Application.unityVersion,
engineSdkVersion = SdkVersionInfoHelpers.GetSdkVersionInfo(),
platform = Application.platform.ToString(),
platformVersion = SystemInfo.operatingSystem,
deviceModel = SystemInfo.deviceModel
Expand Down
Loading