Rojo GitHub CD Publishes Game Without Workspace Buildings

  1. What do you want to achieve? I want to have a custom Rojo CD script for GitHub from this video from @sleitnick that successfully will publish a game file to Roblox with Workspace parts (without having them visible from Visual Studio Code).

  2. What is the issue? Whenever I publish my game with the CD workflow using VS Code and GitHub, my baseplate and all other parts are removed (as they aren’t in the src folder.

  3. What solutions have you tried so far? I’ve looked everywhere for a response, and now I’m trying to make this as searchable and visible as possible for any people with this issue in the future.

my src currently only has ServerScriptService and StarterPlayerScripts (this will be expanded later)
image

My "deploy_staging.yaml" file (which is executed when a push happens on the main branch)
name: Deploy_To_Staging

on:

  push:

    branches:

    - main

jobs:

  deploy:

    name: Deploy

    runs-on: ubuntu-latest

    steps:

    - name: Checkout code

      uses: actions/checkout@v3

    - uses: Roblox/setup-foreman@v1

      name: Install Foreman

      with:

        version: "^1.0.0"

        token: ${{ SECRETS.GITHUB_TOKEN }}

    - run: rojo build -o game.rbxl

    - run: rbxcloud experience publish -f game.rbxl -p 10502858237 -u 3821902738 -t published -a ${{ secrets.API_KEY }}

  lint:

    name: Lint

    runs-on: ubuntu-latest

    steps:

    - name: Checkout code

      uses: actions/checkout@v3

    - uses: Roblox/setup-foreman@v1

      name: Install Foreman

      with:

          version: "^1.0.0"

          token: ${{ SECRETS.GITHUB_TOKEN }}

    - name: Lint

      run: |

        selene ./src

  style:

    name: Styling

    runs-on: ubuntu-latest

    steps:

    - uses: actions/checkout@v3

    - uses: JohnnyMorganz/stylua-action@1.0.0

      with:

        token: ${{ secrets.GITHUB_TOKEN }}

        args: --check ./src

Also, this is sort of a continuation of a previous topic that was solved by sleitnick, but with a different enough problem, that I’ve decided it’s best to move it to another topic to avoid confusion.

This issue is mainly addressed towards sleitnick, but if anyone else can help, that’d obviously be great too :smile:

So, how do I bring my Workspace folder with me on publish? Is it possible?
Thanks :smiley:

1 Like

I’m also still learning this (Very new to it), but from what I’ve researched the problem could be your json file not your layout.
It’s discussed very briefly in this post about rojo in Step 4) pt. 1 “Setup Rojo Fast: The easy way to setup Rojo with Git support”.
Like I said don’t really know what I’m doing, but let me know if this works out for you. Also from my understanding if you want 2-way sync with buildings/models you would need something called remodel from git.

I don’t see what you’re talking about in the link you added. Can you send a quote from that?

I found this link below with a bunch of useful comments, but I don’t know how to execute it. Where do you execute it?

Thanks :smiley:

I got it. (From Topic 1 and 3 of this forum page)

Remodel, if set up properly, can be run as a command. For me, I think I had to run cargo install remodel to make it executable via command line, but I don’t really remember. You can basically add the file below to your project folder as PullAssets.lua (name doesn’t matter, just as an example), and then make your changes to variables:

  • Line 39’s parameter should point to a place file that you’ve saved of your up-to-date game
  • Line 46 should include string names of each service to import
  • Line 50’s second parameter if you want a different location
PullAssets.lua
function splitstring(inputstr, sep)
	if sep == nil then
		sep = "%s"
	end
	local t = {}
	for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do
		table.insert(t, str)
	end
	return t
end

local function GetInstanceFromDatamodel(Datamodel, StringPath)
	local CurrentObjectReference = Datamodel

	for _, ObjectName in pairs(splitstring(StringPath, ".")) do
		if CurrentObjectReference:FindFirstChild(ObjectName) ~= nil then
			CurrentObjectReference = CurrentObjectReference[ObjectName]
		else
			error(ObjectName .. " was not found.")
			return nil
		end
	end

	return CurrentObjectReference
end

local function SaveAssetToFilesystem(Asset, Path)
	for _, Instance in pairs(Asset:GetChildren()) do
		if Instance.ClassName ~= "Folder" then
			print(Path)
			remodel.writeModelFile(Instance, Path .. "/" .. Instance.Name .. ".rbxmx")
		else
			remodel.createDirAll(Path .. "/" .. Instance.Name)
			SaveAssetToFilesystem(Instance, Path .. "/" .. Instance.Name)
		end
	end
end

local Datamodel = remodel.readPlaceFile("assets/robloxgamefile.rbxl")
-- print(Datamodel.Parent)
-- local Pullfrom = GetInstanceFromDatamodel(Datamodel, "Workspace.Parts")
-- local Saveto = "Assets/Workspace"

-- SaveAssetToFilesystem(Pullfrom, Saveto)

local SERVICES = { "Workspace", "Lighting" }
for _, serviceName in ipairs(SERVICES) do
	local service = Datamodel[serviceName]

	remodel.writeModelFile(service, "assets/" .. serviceName .. ".rbxm")
end

Then, you need to edit your default.project.json to include your imported files.

Here's what the syntax looks like in the provided example:
"Workspace": {
      "$path": "assets/Workspace.rbxm"
    },
    "Lighting": {
      "$path": "assets/Lighting.rbxm"
    }
And here's my full default.project.json file if it's not clear where to put that:
{
  "name": "project",
  "tree": {
    "$className": "DataModel",
    "ReplicatedStorage": {
      "$className": "ReplicatedStorage",
      "$ignoreUnknownInstances": true,
      "$path": "src/ReplicatedStorage",
      "Packages": {
        "$path": "Packages"
      }
    },
    "ServerScriptService": {
      "$className": "ServerScriptService",
      "$ignoreUnknownInstances": true,
      "$path": "src/ServerScriptService"
    },
    "StarterPlayer": {
      "$className": "StarterPlayer",
      "StarterCharacterScripts": {
        "$className": "StarterCharacterScripts",
        "$ignoreUnknownInstances": true,
        "$path": "src/StarterPlayer/StarterCharacterScripts" 
      },
      "StarterPlayerScripts": {
        "$className": "StarterPlayerScripts",
        "$ignoreUnknownInstances": true,
        "$path": "src/StarterPlayer/StarterPlayerScripts"
      },
      "$ignoreUnknownInstances": true
    },
    "ServerStorage": {
      "$className": "ServerStorage",
      "$ignoreUnknownInstances": true,
      "$path": "src/ServerStorage"
    },
    "ReplicatedFirst": {
      "$className": "ReplicatedFirst",
      "$ignoreUnknownInstances": true,
      "$path": "src/ReplicatedFirst"
    },
    "Workspace": {
      "$path": "assets/Workspace.rbxm"
    },
    "Lighting": {
      "$path": "assets/Lighting.rbxm"
    }
  }
}

After that setup, run remodel run PullAssets.lua. This should successfully run the command and put the assets wherever you set them to go (By default, “assets”) (Also, you’ll have to create the target directory in advance).

And then you should be able to publish like normal!

Sorry for the long wait time, but I just found this out not too long ago, and wanted to test it before suggesting. Hope this helps! :smiley:

what is this site :skull: ??? ip grabber??

It was a useful article, but I cannot use “rbxl” with remodel, because give me a error “Unknown value type ID 0x20 (32)” and “callback error”

Instead I used “rbxlx”, rojo can build normally and it work with remodel