diff --git a/.github/workflows/changeset-check.yml b/.github/workflows/changeset-check.yml new file mode 100644 index 00000000..b7f78222 --- /dev/null +++ b/.github/workflows/changeset-check.yml @@ -0,0 +1,22 @@ +# Fails a PR that changes the package without a changeset, with a comment +# that links to a prefilled changeset file. The `internal` label skips +# the check. +name: Changeset check + +on: + pull_request: + types: [opened, synchronize, reopened, labeled, unlabeled] + branches: [main] + +permissions: + contents: read + pull-requests: write + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: livekit/verwalter@359985c1e5567b17ae84db0241fbb305c383f89e # v0.30.0 + with: + command: check diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml new file mode 100644 index 00000000..104d5abc --- /dev/null +++ b/.github/workflows/pre-release.yml @@ -0,0 +1,26 @@ +# On demand: open an rc PR from the branch the workflow is run on. The +# level comes from the pending changesets. Merging the PR tags +# v2.2.0-rc.1, and the next run numbers rc.2. Changesets stay pending for +# the final release. +name: Pre-release PR + +on: + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +jobs: + pr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # the tags number the rc + - uses: livekit/verwalter@359985c1e5567b17ae84db0241fbb305c383f89e # v0.30.0 + with: + command: pre-release + args: --target ${{ github.ref_name }} + app-client-id: ${{ secrets.VERWALTER_RELEASE_CLIENT_ID }} + app-private-key: ${{ secrets.VERWALTER_RELEASE_APP_KEY }} diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml new file mode 100644 index 00000000..8e98d3ee --- /dev/null +++ b/.github/workflows/release-pr.yml @@ -0,0 +1,30 @@ +# Keeps one release PR open while changesets are pending. Runs on every +# push to main and regenerates the release branch from main. +name: Release PR + +on: + push: + branches: [main] + +permissions: + contents: write + pull-requests: write + +concurrency: + group: release-pr + cancel-in-progress: true + +jobs: + pr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # the commit that added a changeset gives its changelog line the PR and author + - uses: livekit/verwalter@359985c1e5567b17ae84db0241fbb305c383f89e # v0.30.0 + with: + command: pr + # A GitHub App token lets the release PR start CI. The default + # github.token does not. Without these secrets, github.token is used. + app-client-id: ${{ secrets.VERWALTER_RELEASE_CLIENT_ID }} + app-private-key: ${{ secrets.VERWALTER_RELEASE_APP_KEY }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..7cd25063 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +# After the release PR merges: tag and create the GitHub release. The +# package is installed by git URL and tag, so the tag is the whole release. +# There is no build job and no publish job. +name: Release + +on: + # No branch filter: an rc PR from pre-release.yml targets the branch it + # was run on. The job condition below decides which PRs release. + pull_request: + types: [closed] + # Re-run by hand after a fix: `verwalter release` resumes from the + # current state (tag, release) and skips what is done. + workflow_dispatch: + +permissions: + contents: write + +jobs: + release: + # Only a release PR the tool opened: the branch prefix alone would let + # any pushed `release/*` branch start a release. The author is the + # GitHub App of `app-client-id`. Without an App, it is github-actions[bot]. + if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/') && github.event.pull_request.user.login == 'verwalter-release[bot]' && contains(github.event.pull_request.body, '')) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + # The merge commit itself: a push to main right after the merge + # must not move the tag. + ref: ${{ github.event.pull_request.merge_commit_sha || github.sha }} + fetch-depth: 0 + - uses: livekit/verwalter@359985c1e5567b17ae84db0241fbb305c383f89e # v0.30.0 + with: + command: release + app-client-id: ${{ secrets.VERWALTER_RELEASE_CLIENT_ID }} + app-private-key: ${{ secrets.VERWALTER_RELEASE_APP_KEY }} diff --git a/AGENTS.md b/AGENTS.md index 1acfc5e9..818156bd 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -32,7 +32,8 @@ Scripts~/build_ffi_locally.sh [build_type] ### Other scripts in `Scripts~/` - `download_libs.py` — downloads the prebuilt FFI binaries for all platforms; the release tag is pinned in `version.ini` - `generate_proto.sh` — regenerates `Runtime/Scripts/Proto/` from the protobuf definitions in `client-sdk-rust~/livekit-ffi/protocol` (requires `protoc`) -- `build_docs.sh`, `prepare_release.py`, `unity_test_results_utils.py` — docs generation, release preparation, CI test-result parsing +- `prepare_release.py ` — updates the FFI: `version.ini`, the prebuilt binaries, the submodule and the generated protobuf code. It does not touch the SDK version +- `build_docs.sh`, `unity_test_results_utils.py` — docs generation, CI test-result parsing ### Run tests Tests require a local LiveKit server running: @@ -79,6 +80,9 @@ Key internal files: - `Samples~/Meet` — more complete multi-participant example (LiveKit Meet-like), default project for `run_unity.sh` - `Samples~/Agents` — connect to an agent and display the transcript +### Releases +[verwalter](https://github.com/livekit/verwalter) releases the package. Every PR that changes the package adds a changeset file in `.changeset/` (`verwalter changeset --level patch|minor|major`), or carries the `internal` label. Each push to `main` updates one release PR. Merging it bumps `package.json`, writes `CHANGELOG.md`, tags `vX.Y.Z` and creates the GitHub release. Never edit the version by hand. + ### Rust Submodule `client-sdk-rust~/` is a git submodule pointing to the shared Rust SDK. The `~` suffix tells Unity to ignore the directory. diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..a7bd7795 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +# Changelog + +The notes for 2.1.1 and earlier are on the [releases page](https://github.com/livekit/client-sdk-unity/releases). diff --git a/CHANGELOG.md.meta b/CHANGELOG.md.meta new file mode 100644 index 00000000..dc29fb81 --- /dev/null +++ b/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: aa149db2ee6a492b892eeed9b2519696 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/README.md b/README.md index a566c6a0..5e2c20b7 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ cd client-sdk-unity ``` Or you can import the Git url `https://github.com/livekit/client-sdk-unity.git` from the package manager. -If you want to use tagged release versions, use `https://github.com/livekit/client-sdk-unity.git#vX.X.X`, for example with `#v1.3.5`. +If you want to use tagged release versions, use `https://github.com/livekit/client-sdk-unity.git#vX.X.X`, for example with `#v2.1.1`. ### Using OpenUPM diff --git a/Scripts~/prepare_release.py b/Scripts~/prepare_release.py index d62d1fea..b623017b 100644 --- a/Scripts~/prepare_release.py +++ b/Scripts~/prepare_release.py @@ -1,6 +1,5 @@ import argparse import configparser -import json import os from pathlib import Path import shutil @@ -12,18 +11,6 @@ REPO_ROOT = Path(__file__).resolve().parent.parent -def update_package_json(version): - print(f"\n=== Updating package.json to version {version} ===") - with open("package.json", "r") as f: - data = json.load(f) - data["version"] = version - data["changelogUrl"] = f"https://github.com/livekit/client-sdk-unity/releases/tag/v{version}" - with open("package.json", "w") as f: - json.dump(data, f, indent=2) - f.write("\n") - print("Done.") - - def update_version_ini(ffi_version): tag = f"livekit-ffi@v{ffi_version}" print(f"\n=== Updating version.ini tag to {tag} ===") @@ -70,7 +57,6 @@ def stage_all_changes(): print("\n=== Staging all changes ===") subprocess.run([ "git", "add", - "package.json", "version.ini", "Runtime/Plugins", "client-sdk-rust~", @@ -82,14 +68,12 @@ def stage_all_changes(): def main(): os.chdir(REPO_ROOT) - parser = argparse.ArgumentParser(description="Prepare the repo for a new release.") - parser.add_argument("sdk_version", help="SDK version (e.g. 1.4.0)") + parser = argparse.ArgumentParser(description="Update the repo to a new FFI version. verwalter owns the SDK version.") parser.add_argument("ffi_version", help="FFI version (e.g. 0.12.53)") args = parser.parse_args() - print(f"Preparing release: SDK v{args.sdk_version}, FFI v{args.ffi_version}") + print(f"Updating FFI to v{args.ffi_version}") - update_package_json(args.sdk_version) update_version_ini(args.ffi_version) download_ffi_binaries() update_submodule(args.ffi_version) diff --git a/verwalter.toml b/verwalter.toml new file mode 100644 index 00000000..cac373f2 --- /dev/null +++ b/verwalter.toml @@ -0,0 +1,9 @@ +#:schema https://raw.githubusercontent.com/livekit/verwalter/main/schemas/v1.json + +[packages."io.livekit.livekit-sdk"] +path = "." +versioning.files = [ + "package.json", + { path = "package.json", regex = 'releases/tag/v(?[^"]+)' }, + { path = "README.md", regex = '`#v(?\d[^`]*)`' }, +] diff --git a/verwalter.toml.meta b/verwalter.toml.meta new file mode 100644 index 00000000..9329a34c --- /dev/null +++ b/verwalter.toml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9ef0c271fbeb46e98e212c6f34a5aa04 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: