Skip to content
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
125 changes: 0 additions & 125 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ on:
- 'v*'
pull_request:
workflow_dispatch:
inputs:
version:
description: 'UPM version to build (without leading v), e.g. 3.0.0. Only used by the upm job; the main build runs on the current ref.'
required: false

permissions:
contents: read
Expand Down Expand Up @@ -74,124 +70,3 @@ jobs:
--api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}" \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate

upm:
# Assembles the Unity Package Manager distribution from unity-template/ +
# the freshly-built DLL and publishes it to the dedicated
# `enjin/platform-unity-sdk` repo: the package tree is committed to that
# repo's `master` branch (latest, always browsable) and pinned with a
# `v<version>` git tag. Users reference either in their Unity Package
# Manager git URL:
# https://github.com/enjin/platform-unity-sdk.git (latest)
# https://github.com/enjin/platform-unity-sdk.git#v3.0.0 (pinned)
# The tarball is also uploaded as a workflow artifact for inspection. This
# job does not touch this repo's GitHub Release — that is created/published
# manually so it stays compatible with immutable releases.
needs: build
# Run on v* tag pushes, or on manual dispatches that supply a version. A
# workflow_dispatch with an empty version input is treated as "main build
# only" and skips the UPM job rather than hard-failing.
if: |
startsWith(github.ref, 'refs/tags/v')
|| (github.event_name == 'workflow_dispatch' && github.event.inputs.version != '')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Determine version
id: version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
VERSION="${{ github.event.inputs.version }}"
if [[ -z "${VERSION}" ]]; then
echo "::error::workflow_dispatch requires the 'version' input"
exit 1
fi
TAG="v${VERSION}"
elif [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
# strip leading 'v' from refs/tags/v3.0.0
VERSION="${GITHUB_REF_NAME#v}"
TAG="v${VERSION}"
else
echo "::error::upm job triggered on an unsupported ref ${GITHUB_REF}"
exit 1
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "Building UPM package for version ${VERSION} (tag ${TAG})"

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x

- name: Cache NuGet Packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Build SDK (Release)
run: dotnet build ./src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Enjin.Platform.Sdk.csproj --configuration Release

- name: Assemble UPM package
run: ./scripts/assemble-upm.sh ${{ steps.version.outputs.version }}

- name: Setup SSH
# Loads the deploy-key for enjin/platform-unity-sdk so the publish step
# below can push over SSH. webfactory/ssh-agent also adds github.com to
# known_hosts. The matching public key must be registered as a
# write-enabled deploy key on enjin/platform-unity-sdk.
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.UNITY_SDK_DEPLOY_KEY }}

- name: Publish package to platform-unity-sdk
# Commits the assembled upm-staging/ tree to the dedicated repo's master
# branch (latest) and pins it with a v<version> tag. End users reference
# either in their Unity Package Manager git URL:
# https://github.com/enjin/platform-unity-sdk.git (latest)
# https://github.com/enjin/platform-unity-sdk.git#v3.0.0 (pinned)
# The package lives at the repo root, so no ?path= suffix is needed.
run: |
set -euo pipefail
VERSION="${{ steps.version.outputs.version }}"
TAG="${{ steps.version.outputs.tag }}"
BRANCH="master"

WORK="$(mktemp -d)"
git clone --depth 1 git@github.com:enjin/platform-unity-sdk.git "${WORK}"
(
cd "${WORK}"
git checkout -B "${BRANCH}"
# Replace tracked contents with the freshly assembled package.
git rm -rqf . >/dev/null 2>&1 || true
cp -R "${GITHUB_WORKSPACE}/upm-staging/." .
git add -A
# Skip the commit when the assembled package is identical to the
# current branch contents (e.g. re-running a release tag), so the
# job stays idempotent instead of failing on "nothing to commit".
if git diff --cached --quiet; then
echo "UPM package contents unchanged; skipping commit"
else
git -c user.name="github-actions[bot]" \
-c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
commit -m "UPM package v${VERSION}"
fi
git tag -f "${TAG}"
git push origin "HEAD:${BRANCH}"
git push -f origin "refs/tags/${TAG}"
)
rm -rf "${WORK}"
echo "Published v${VERSION} to platform-unity-sdk (${BRANCH} + tag ${TAG})"

- name: Upload tarball as workflow artifact
# Always upload (including workflow_dispatch runs) so manual builds are
# downloadable for inspection without needing a release.
uses: actions/upload-artifact@v4
with:
name: EnjinPlatformSdk-v${{ steps.version.outputs.version }}-upm
path: EnjinPlatformSdk-v${{ steps.version.outputs.version }}-upm.tar.gz
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,3 @@ FodyWeavers.xsd
# Smoke runner secrets (see tools/SdkSmoke/README.md)
tools/SdkSmoke/.env

# Unity package assembly output (regenerated by scripts/assemble-upm.sh / unity.yml)
upm-staging/
EnjinPlatformSdk-v*-upm.tar.gz

# Re-include the hand-crafted Unity .meta files in unity-template/
# (overrides the global *.meta ignore from the VisualStudio template above)
!unity-template/**/*.meta

11 changes: 1 addition & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
fields.
- Smoke tests for `PlatformClient` covering success, error, and bearer-token paths against a WireMock
server.
- Unity Package Manager (UPM) distribution: every `v*` tag push assembles a UPM package
(manifest, precompiled `Enjin.Platform.Sdk.dll`, XML docs, IL2CPP `link.xml`, third-party
notices) from `unity-template/` via `scripts/assemble-upm.sh` and the
`.github/workflows/unity.yml` workflow. The package is published as a parallel
`upm/v<version>` git tag (installable as
`https://github.com/enjin/platform-csharp-sdk.git#upm/v<version>`) and attached as a
tarball to the GitHub Release. Declares `com.unity.nuget.newtonsoft-json` 3.2.1 as its
only dependency; requires Unity 2021.3 LTS with the .NET Standard 2.1 API compatibility
level.

### Changed

- **Breaking:** SDK now targets the Enjin Platform v3 GraphQL API. The v2 schema and all hand-written
v2 operation/model classes have been removed.
- **Breaking:** Target framework lowered from `.NET Standard 2.0` to `.NET Standard 2.1` so the SDK
can be consumed from Unity 2021.2+ and Godot 4+.
can be consumed from Godot 4+.
- **Breaking:** JSON serialization moved from `System.Text.Json` to `Newtonsoft.Json` (13.0.3) to match
the generator's runtime and engine ecosystem expectations.
- **Breaking:** `PlatformHandler` now attaches `Authorization: Bearer <token>` (previously the scheme
Expand Down
40 changes: 0 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,53 +17,13 @@ Starting with version 3.0.0 the SDK ships as a single package targeting the v3 P
sub-packages (`Enjin.Platform.Sdk.Beam`, `Enjin.Platform.Sdk.FuelTanks`, `Enjin.Platform.Sdk.Marketplace`) have been
discontinued — all functionality now lives in `Enjin.Platform.Sdk`.

Unity developers can install the SDK directly from the Unity Package Manager — see
[Install in Unity](#install-in-unity) below.

## Compatibility

This SDK targets **.NET Standard 2.1**, which is compatible with:

* .NET 5.0+
* Unity 2021.3 LTS or newer (using the .NET Standard 2.1 API compatibility level)
* Godot 4.0 or newer (using .NET 6+ / .NET Standard 2.1)

Godot users should install via NuGet (`dotnet add package Enjin.Platform.Sdk`); the UPM
distribution described below is Unity-specific.

## Install in Unity

The SDK is published as a Unity Package Manager (UPM) package on every tagged release, in the
dedicated [`enjin/platform-unity-sdk`](https://github.com/enjin/platform-unity-sdk) distribution
repo. The package contains the precompiled `Enjin.Platform.Sdk.dll`, XML documentation, and an
IL2CPP `link.xml` to keep the SDK's types from being stripped on AOT targets.

1. Open your Unity project (**2021.3 LTS or newer**).
2. Set **Edit ▸ Project Settings ▸ Player ▸ Other Settings ▸ Api Compatibility Level** to **.NET Standard 2.1**.
3. Open **Window ▸ Package Manager**.
4. Click **+** ▸ **Add package from git URL…** and paste:

```
https://github.com/enjin/platform-unity-sdk.git
```

This tracks the latest published package. To pin a specific version, append a `#v<version>`
suffix (e.g. `…platform-unity-sdk.git#v3.0.2`). Available versions are listed on the
[tags](https://github.com/enjin/platform-unity-sdk/tags) page; each release is pinned with a
matching `v<version>` tag.

The Package Manager will automatically resolve the
[`com.unity.nuget.newtonsoft-json`](https://docs.unity3d.com/Packages/com.unity.nuget.newtonsoft-json@3.2/manual/index.html)
dependency, which is the only third-party library required at runtime.

### IL2CPP notes

The shipped `link.xml` preserves the entire `Enjin.Platform.Sdk` assembly from the IL2CPP
managed code stripper. This is necessary because the SDK uses Newtonsoft.Json reflection
to (de)serialize the GraphQL response model. If you ship to mobile, console, or WebGL
and need to shrink build size, you can replace the bundled `Runtime/link.xml` with a
narrower ruleset, but verify against your real responses first.

## Quick start

```csharp
Expand Down
124 changes: 0 additions & 124 deletions scripts/assemble-upm.sh

This file was deleted.

7 changes: 0 additions & 7 deletions unity-template/CHANGELOG.md.meta

This file was deleted.

7 changes: 0 additions & 7 deletions unity-template/LICENSE.md.meta

This file was deleted.

Loading
Loading