Automation is GOOD!
About
Many developers are seeking to use external tools like Rojo or Argon, but many don’t know that you can improve your productivity and team management by simply using a tool like git and GitHub. You can allow each of your developers to have his own coding space and then merge them together into your testing space; once tested, you are free to publish your game to “production”, fully automatically (well, almost).
How is it done?
Tools like Rojo allow you to sync Roblox Studio with other code editors or IDEs like Visual Studio Code. That not only allows you to use third-party extensions, but also version control with git, easier styling, colorizing, and adding themes to your editor, more powerful AI, auto-complete tools like GitHub Copilot, powerful linters, lua language servers and much more. Let’s look at a graph of how our system will work:
credits to this person’s post for this image
With Fully Managed Rojo it’s very easy to implement this since Rojo already has a compiler to automatically build your place file, which you can then use. In our case, though, we are only using Partially Managed Rojo. This means that Rojo will only be used for scripting purposes and not edit the game completely. It is not recommended to use Fully Managed Rojo because it’s just too incompatible and can always run into an error while building it. Rojo is also not maintained well anymore, which makes it really outdated. This is why this Tutorial is also compatible with the best (in my opinion) Rojo Alternative called Argon. It offers a vast variety of functions and better support for most stuff, and it’s just easier to set up. What you pick is your choice, since we are going to manually build the place file each time.
Okay, let’s do it!
The fact that you are looking at this post means that you at least have a basic understanding of what you are reading or doing. If you are not familiar with what is going on, you should take a deeper look into what Rojo is before getting into this topic. Git and version control are hard to learn, and I am not a master in either.
Here is a very useful video with something similar, but for Fully Managed Rojo.
Watch it if you need a video example of what we are doing. Keep in mind that this video uses foreman, which is outdated; aftman is very similar.
I made a repository that you can find here, feel free to use it as an example. It has all default stuff you need. Once you download it you should be already set up to use it, simply change the IDs of your places and you are good to go.
First of all, head to your Rojo or Argon project. If you don’t have Aftman installed, then follow the instructions in the dropdown.
What is Aftman and how do I install it?
Aftman is basically a package manager. It is a straight replacement of the old popular package manager for most external Roblox and Lua libraries, called Foreman. Foreman is being replaced by aftman; both are good, but aftman is just better.
It is highly recommended to install Rust Lang since most of the libraries are available there and you might just learn something more, but if you don’t wish to install Rust, then follow the official documentation of Aftman on how to install it without Rust. Here.
First of all, install the Rust programming language. That will also install cargo, which is a package manager like npm. After you get rust installed, simply open up a terminal and enter cargo install aftman
. After it’s done installing, make sure to run aftman self-install
and finally confirm you have aftman installed with aftman --version
. Now you have it installed!
Open up a terminal in the directory of your Rojo project file and type aftman init
.
That will create a new aftman.toml
file, which will contain an example of how we are going to use it. In this tutorial, we are going to be using quite a lot of dependencies. You can just copy the snippet below to your file.
[tools]
stylua = "JohnnyMorganz/StyLua@0.18.0"
selene = "Kampfkarren/selene@0.25.0"
rojo = "rojo-rbx/rojo@7.3.0"
rbxcloud = "Sleitnick/rbxcloud@0.5.0"
StyLua a code formatter that makes your code look better and more readable. Very useful when collaborating in a team. Makes your code stand out.
Selene a Lua code linter. Basically, it finds issues and problems in your code that you need to resolve. For example, unused variables or type errors This will be your main saver for when someone makes a mistake on your team but doesn’t correct it.
Rojo of course.
Rbxcloud open-source CLI library for accessing the Roblox Open Cloud. We are going to use it to publish our games automatically.
Remember to aftman install
and then make sure to aftman list
to confirm everything installed. You can also optionally try each of the tools command interfaces.
rojo --version
, stylua --version
, selene --version
, rbxcloud --version
, etc.
Now make a new file in the directory of your project called selene.toml
. This would be an essential configuration file for Selene. Inside, put the following:
std = "roblox"
That should be it.
Now make a folder in the directory of the project called .github
. Also, make sure you have a PRIVATE repository on Github; initialize it if you don’t. Now head over to the folder and create another folder inside .github called workflows
. Now create 3 files each named like this:
ci.yaml
- Checks with StyLua and Selene for code problems.
deploy_prod.yaml
- Auto publish your game into the main place once your update is ready.
deploy_staging.yaml
- Auto publish your game into the testing place only accessible by developers or your testers.
ci.yaml
name: CI
on:
push:
branches:
- dev
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- uses: ok-nick/setup-aftman@v0.3.0
name: Install aftman
with:
token: ${{ SECRETS.GITHUB_TOKEN }}
- name: Lint
run: |
selene ./src
style:
name: Styling
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: StyLua
uses: JohnnyMorganz/stylua-action@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check ./src
deploy_prod.yaml
name: Deploy to Production
on:
push:
tags:
- 'v*'
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: ok-nick/setup-aftman@v0.3.0
name: Install aftman
with:
token: ${{ SECRETS.GITHUB_TOKEN }}
- run: rbxcloud experience publish -f game.rbxl -p ? -u ? -t published -a ${{ secrets.API_KEY }}
deploy_staging.yaml
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: ok-nick/setup-aftman@v0.3.0
name: Install aftman
with:
token: ${{ SECRETS.GITHUB_TOKEN }}
- run: rbxcloud experience publish -f game.rbxl -p ? -u ? -t published -a ${{ secrets.API_KEY }}
Now that you have all that done, you will notice a few things. There are ?
question marks in some parts. Now, let’s head to our main game, where people play. Open it in Studio, open the command bar, and type print(game.PlaceId, game.GameId)
. Now under the deploy_prod.yaml
file, on the very bottom, where the question marks are, replace the first mark with game.PlaceId, and the second one with game.GameId. Repeat the same step for deploy_staging.yaml
, open your testing place in Studio, run the command in the bar, and replace the question marks in the file. Now that’s set up, head over to your GitHub repository settings, go to secrets and variables, then actions. There is a new secret. Name it API_KEY
. For the value, head over to the credential tab of your game. Make a new key, name it whatever, and describe it whatever. Add Place Publishing to the API system. Select both of your games, the main and testing.
(for better security, you might want to use an alternate account and also make a key for each place in case one gets compromised. (To add a second key, just name it API_KEY2
on GitHub, and depending on which game it is, change ${{ secrets.API_KEY }}
to ${{ secrets.API_KEY2 }}
in the file depending on what game it is.)
Add write permissions; under IPs, enter 0.0.0.0/0
if you don’t know what you are doing. If you do, then add the IPs you need.
Create the key, copy it, paste it to GitHub, and you are ready to go.
Remember to remove your place file from .gitignore
if it was there.
Commit and push all your changes; if you did everything correctly, it should work. Now on your repository tab, under actions, a new workflow should appear. Look for any errors. If you do get any, try to resolve them with the power of the internet. If you can’t, leave a reply here and I or someone else will be here to help you.
Now onto more details. Your GitHub repository must have two branches set up. main
and dev
Now let me explain how it works.
All developers will only commit changes to the dev
branch. After your test build is done, someone will open Roblox Studio, sync their place with Rojo, then go to the top right corner, file, and click on download a copy. Then save that copy to the directory of the project file and make sure to name it game.rbxl
. This will be your test version. Now, commit changes to the dev
branch and make a pull request to merge dev
with main
. If there are no issues with the code, a higher-up with permissions can merge them. After it merges them, it should now upload that test file to your testing place for developers and testers automatically. From there, simply test your game and make more updates until you are ready to release your update to the community. Once you are done, make sure you select the main branch, press on Create a new release or tag, and then make your tag start with v
. It MUST start with v
unless you configure it otherwise. You can put anything after v. For example, v0.1.5-alphaFor example, "v0.1.5-alpha," "v0.3.4", "v2.8.9-release
, etc. Add a name, description, etc., and create the release. GitHub should now automatically get that same file that you downloaded from Studio, and then it will upload it automatically to your main game for people to play. This allows for a lot of permission management in your development team, and it’s just an overall must-have for teams with more than 2–3 people. It makes life easier, and most importantly, on a professional level.
Here is how your final root directory should look:
Here are GitHub actions doing their stuff:
Here is how I like my vscode personally:
Everything is nice and clean.
Thank you for taking a look at this tutorial. For any feedback, please leave a reply or hit me up in DMs. Now go and master the full power of Roblox Studio and extensions.
Here is what I use from my vscode extensions:
- rojo
- selene
- stylua
- codesnap
- discord presence
- gitlens
- material icon theme
- roblox lsp
- toggle quotes
- vibrancy (transparent background)
I hope this suits you well, good luck!
This is my first post in this category. I’m sorry for any mistakes or misunderstandings. Please correct me if I’m wrong.