Skip to content

Commit e772b38

Browse files
authored
Update README with comprehensive setup steps (#11)
1 parent 09dc89a commit e772b38

File tree

7 files changed

+90
-34
lines changed

7 files changed

+90
-34
lines changed

README.md

Lines changed: 81 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ Requires [Lune](https://github.com/lune-org/lune) 0.9.3+
88
$ git clone https://github.com/ghostnaps/rbxasset.git
99
```
1010

11+
Then define a Luau script to use it:
12+
13+
```luau
14+
local rbxasset = require("./path/to/rbxasset/src")
15+
```
16+
1117
# Usage
1218

13-
Create an `rbxasset.toml` file in your project with the following content:
19+
Create an `rbxasset.toml` file in your project with the following content. Replace the environment configuration with values for the creator and experience to upload with.
1420

1521
```toml
1622
[assets.default]
@@ -27,43 +33,93 @@ universeId = 7854970752
2733
placeId = 119490202754966
2834
```
2935

30-
To get deployment to work properly, the following are required:
31-
* `creatorId`: The ID of the User or Group that will own the published assets
32-
* `creatorType`: Either `"User"` or `"Group"`. This is just to tell rbxasset how to interpret `creatorId`
33-
* `universeId`: The `game.GameId` of an experience that will be used for Luau Execution. The experience must be owned by the asset creator
34-
* `placeId`: The `game.PlaceId` of an experience that will be used for Luau Execution. The experience must be owned by the asset creator
36+
This defines a `default` asset and a `production` environment to deploy to.
37+
38+
Then create a Luau script to handle the deployment:
39+
40+
```luau
41+
-- .lune/publish.luau
42+
local process = require("@lune/process")
43+
44+
local rbxasset = require("./path/to/rbxasset/src")
45+
46+
local apiKey = process.args[1]
47+
assert(apiKey, "argument #1 must be a valid Open Cloud API key")
48+
49+
-- The rbxm file needs to be built manually. rbxasset makes no assumptions about
50+
-- how your project is setup, it only cares about having a file to upload. Note
51+
-- the filename `build.rbxm` matches the `model` field in rbxasset.toml
52+
process.exec("rojo", { "build", "-o", "build.rbxm" })
53+
54+
-- Publish the `default` asset defined in rbxasset.toml
55+
rbxasset.publishPackageAsync(process.cwd, "default", apiKey)
56+
```
57+
58+
```sh
59+
$ lune run publish <API_KEY>
60+
```
61+
62+
Where `<API_KEY>` represents an Open Cloud API key. See below for the exact setup for the key.
63+
64+
## Open Cloud setup
3565

36-
## API Key
66+
To get this all working you will need two things: an Open Cloud API key, and an Experience to handle asset publishing.
3767

38-
You will also need an Open Cloud API key with the following scopes:
68+
### Asset uploader experience
69+
70+
Create a new Experience for the user or group that will own the asset. A fresh Baseplate named anything you like will do just fine.
71+
72+
![Screenshot of the Publish Game dialog window in Studio for uploading the new Experience. The name is set to "Asset Uploader" and is being published to a Group](img/publish-game-dialog.png)
73+
74+
Once the Experience is published, run the following from the command line:
75+
76+
```luau
77+
print(game.GameId, game.PlaceId)
78+
```
79+
80+
Copy both values and add them to `rbxasset.toml` for the environment's `universeId` and `placeId`, respectively.
81+
82+
> [!NOTE]
83+
> In the future the hope is to not require an Experience to be created for the purpose of asset uploading. The reason this is needed right now is to close the gap of creating/updating the asset on the Creator Store via `CreateAssetAsync` and `CreateAssetVersionAsync`. If/when Open Cloud supports taking an rbxm file as input to create/update an asset, it will no longer be a requirement to setup an experience for asset uploading
84+
85+
### API key
86+
87+
An Open Cloud API key with the following scopes is required:
3988
* `asset:read` and `asset:write`
4089
* `universe-places:write`
4190
* `universe.place.luau-execution-session:write`
4291

4392
The resulting permissions should be setup similar to the following:
4493

45-
![Screenshot of the Edit API Key page showing the access permissions](img/api-key-scopes.png)
94+
![Screenshot of the Edit API Key page showing the Access Permissions section](img/access-permissions.png)
4695

47-
## Package syncing
96+
# Manifest format
4897

49-
The following example will take an rbxm file and upload it to the Creator Store using `rbxasset.toml` to define what the
50-
display name, description, and icon will be.
98+
This section details the various fields that can be supplied for assets and environments in `rbxasset.toml`
5199

52-
```luau
53-
-- .lune/publish.luau
54-
local process = require("@lune/process")
100+
## Assets
55101

56-
local rbxasset = require("rbxasset")
102+
Assets define how the asset will be deployed and shown on the Creator Store.
57103

58-
local modelPath = process.args[1]
59-
local apiKey = process.args[2]
60-
local projectPath = process.cwd
104+
| Field | Type | Description |
105+
| ------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
106+
| `name` | `string` | The name of the asset on the Creator Store |
107+
| `model` | `string` | Path to the rbxm to upload, relative to `rbxasset.toml` |
108+
| `environment` | `string` | Defines which environment to deploy to. This value must equal one of the environments defined in the `environments` object |
109+
| `description` | `string?` | The description of the asset on the Creator Store |
110+
| `icon` | `string?` | Path to the icon (png only) to display on the Creator Store |
111+
| `description` | `string?` | The description of the asset on the Creator Store |
112+
| `type` | `"Package" \| "Plugin"` | The type of asset to upload to the Creator Store. This must be set before the first publish as asset type is immutable once uploaded. Defaults to `"Package"` |
61113

62-
rbxasset.publishPackageAsync(projectPath, modelPath, apiKey)
63-
```
114+
## Environments
115+
116+
Environments define where an asset will be deployed to. Only one environment is required, but more can be added to setup production/staging deployments.
117+
118+
| Field | Type | Description |
119+
| ------------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------- |
120+
| `creatorId` | `number` | The ID of the User or Group that will own the published assets |
121+
| `creatorType` | `"User" \| "Group` | Either `"User"` or `"Group"`. This is just to tell rbxasset how to interpret `creatorId` |
122+
| `universeId` | `number` | The `game.GameId` of an experience that will be used for Luau Execution. The experience must be owned by the asset creator |
123+
| `placeId` | `number` | The `game.PlaceId` of an experience that will be used for Luau Execution. The experience must be owned by the asset creator |
64124

65-
```sh
66-
$ lune run publish build.rbxm <API_KEY>
67-
```
68125

69-
Where `<API_KEY>` represents an Open Cloud API key with `asset:read` and `asset:write` permissions.

examples/package/rbxasset.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ icon = "icon.png"
66
model = "asset.rbxm"
77

88
[environments.production]
9-
creatorId = 35175308
9+
creatorId = 608082596
1010
creatorType = "Group"
11-
universeId = 7854970752
12-
placeId = 119490202754966
11+
universeId = 7943381724
12+
placeId = 74265882577854

examples/plugin/rbxasset.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ icon = "icon.png"
77
type = "Plugin"
88

99
[environments.production]
10-
creatorId = 35175308
10+
creatorId = 608082596
1111
creatorType = "Group"
12-
universeId = 7854970752
13-
placeId = 119490202754966
12+
universeId = 7943381724
13+
placeId = 74265882577854

examples/workspace/rbxasset.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ model = "plugin.rbxm"
1414
type = "Plugin"
1515

1616
[environments.production]
17-
creatorId = 35175308
17+
creatorId = 608082596
1818
creatorType = "Group"
19-
universeId = 7854970752
20-
placeId = 119490202754966
19+
universeId = 7943381724
20+
placeId = 74265882577854

img/access-permissions.png

127 KB
Loading

img/api-key-scopes.png

-122 KB
Binary file not shown.

img/publish-game-dialog.png

125 KB
Loading

0 commit comments

Comments
 (0)