Skip to content

Commit 09dc89a

Browse files
authored
Support multiple assets and environments (#8)
The goal is to be able to have config files that look like this: ```toml [assets.package] name = "Package Name" environment = "production" description = "Longform description" icon = "icon.png" distribute = true [assets.plugin] name = "Example Plugin" environment = "production" description = "Longform description" distribute = true icon = "icon.png" type = "Plugin" [assets.plugin-staging] name = "Example Plugin [DEV]" environment = "staging" description = "Development variant" icon = "icon.png" type = "Plugin" distribute = true [environments.production] creatorId = 11111111 creatorType = "Group" placeId = 119490202754966 universeId = 7854970752 [environments.staging] creatorId = 222222222 creatorType = "Group" placeId = 119490202754966 universeId = 7854970752 ```
1 parent d1dbd50 commit 09dc89a

33 files changed

+569
-226
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,25 @@ $ git clone https://github.com/ghostnaps/rbxasset.git
1313
Create an `rbxasset.toml` file in your project with the following content:
1414

1515
```toml
16-
[asset]
16+
[assets.default]
1717
name = "Display Name"
18+
model = "build.rbxm"
19+
environment = "production"
1820
description = "Longform project description"
1921
icon = "img/icon.png"
20-
distribute = true
2122

22-
[deployment]
23+
[environments.production]
2324
creatorId = 35175308
2425
creatorType = "Group"
2526
universeId = 7854970752
2627
placeId = 119490202754966
2728
```
2829

2930
To get deployment to work properly, the following are required:
30-
* `creatorId`: The ID of the User or Group that will own the published asset
31+
* `creatorId`: The ID of the User or Group that will own the published assets
3132
* `creatorType`: Either `"User"` or `"Group"`. This is just to tell rbxasset how to interpret `creatorId`
32-
* `universeId`: The `game.GameId` of an experience that will be used for Luau Execution. The experience must be owned by the same Creator
33-
* `placeId`: The `game.PlaceId` of an experience that will be used for Luau Execution
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
3435

3536
## API Key
3637

examples/package/deploy.luau

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ assert(process.cwd:match("examples/package"), "you must be in the `examples/pack
99

1010
process.exec("rojo", { "build", "-o", "asset.rbxm" })
1111

12-
rbxasset.publishPackageAsync(process.cwd, "asset.rbxm", apiKey)
12+
rbxasset.publishPackageAsync(process.cwd, "package", apiKey)

examples/package/rbxasset-manifest.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[assets.package]
12
assetId = "70942996502762"
23

34
[images."icon.png"]

examples/package/rbxasset.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
[asset]
1+
[assets.package]
22
name = "Display Name"
3+
environment = "production"
34
description = "Longform description"
45
icon = "icon.png"
5-
distribute = true
6+
model = "asset.rbxm"
67

7-
[deployment]
8+
[environments.production]
89
creatorId = 35175308
910
creatorType = "Group"
1011
universeId = 7854970752
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("This is a plugin!")

examples/plugin/deploy.luau

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ assert(process.cwd:match("examples/plugin"), "you must be in the `examples/plugi
99

1010
process.exec("rojo", { "build", "-o", "plugin.rbxm" })
1111

12-
rbxasset.publishPackageAsync(process.cwd, "plugin.rbxm", apiKey)
12+
rbxasset.publishPackageAsync(process.cwd, "plugin", apiKey)
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
assetId = "104757825775127"
1+
[assets.plugin]
2+
assetId = "136176915775390"
23

3-
[images."icon.png"]
4-
assetId = "124561703176693"
5-
hash = "fac185770cf5e824d4c0a9b59e547df42dc10011c5ad139bfc2c7e1507eef631"
4+
[images]

examples/plugin/rbxasset.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
[asset]
1+
[assets.plugin]
22
name = "Example Plugin"
3+
model = "plugin.rbxm"
4+
environment = "production"
35
description = "Longform description"
46
icon = "icon.png"
57
type = "Plugin"
6-
distribute = true
78

8-
[deployment]
9+
[environments.production]
910
creatorId = 35175308
1011
creatorType = "Group"
1112
universeId = 7854970752

examples/workspace/deploy.luau

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
local rbxasset = require("@root/")
2+
3+
local process = require("@lune/process")
4+
5+
local apiKey = process.args[1]
6+
assert(apiKey, "argument #1 must be a valid Open Cloud API key")
7+
8+
assert(
9+
process.cwd:match("examples/workspace"),
10+
"you must be in the `examples/workspace` folder when running this script"
11+
)
12+
13+
process.exec("rojo", { "build", "-o", "../package.rbxm" }, {
14+
cwd = "package",
15+
})
16+
17+
process.exec("rojo", { "build", "-o", "../plugin.rbxm" }, {
18+
cwd = "plugin",
19+
})
20+
21+
rbxasset.publishWorkspaceAsync(process.cwd, apiKey)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "WorkspacePackage",
3+
"tree": {
4+
"$path": "src"
5+
}
6+
}

0 commit comments

Comments
 (0)