Skip to content

Instantly share code, notes, and snippets.

Last active December 15, 2023 12:42
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save boatbomber/b9f10b7f5abfadc11a2cae0966bc5813 to your computer and use it in GitHub Desktop.
Save boatbomber/b9f10b7f5abfadc11a2cae0966bc5813 to your computer and use it in GitHub Desktop.
A publishing workflow for Roblox projects
## Welcome to boatbomber's publish workflow.
# You'll need a few things in your GitHub Action secrets for this to work:
# - ROBLOSECURITY : A cookie of a Roblox account (used to install Studio for testing)
# - RBXID : Another cookie from the account (also used in Studio install)
# - PUBLISHCLOUD : A Roblox OpenCloud API key with Write permission in Place Management for your game
# This workflow assumes that you have:
# - A `aftman.toml` with rojo, wally, selene, darklua, and run-in-roblox
# - A `default.project.json` that builds a place file
# - A `tests.project.json` that builds a place file
# - A `tests/TestRunner.lua` that runs your tests
# You'll also need to set the env variables below to your correct IDs for place/universe, of course.
name: Publish
TESTING_PLACE: '2083920096'
PRODUCTION_PLACE: '1334669864'
description: 'Pick where to publish to'
required: true
type: choice
default: 'Testing'
- Testing
- Production
description: 'Require passing tests before publishing'
required: false
type: boolean
default: false
description: 'Process and minify source code before publishing'
required: false
type: boolean
default: true
runs-on: windows-latest
# Logging
- name: Log chosen inputs
shell: bash
run: |
echo "Publish Target: ${{ }}"
echo "Require Tests Passing: ${{ github.event.inputs.requireTest }}"
echo "Process Source Code: ${{ github.event.inputs.shouldProcess }}"
# Dependencies
- name: Checkout repository
uses: actions/checkout@v3
- name: Check for cookies and keys
shell: bash
run: |
if [ -z "${{ secrets.ROBLOSECURITY }}" ]; then echo 'Missing ROBLOSECURITY secret!'; exit 1; else echo 'Found ROBLOSECURITY secret...'; fi
if [ -z "${{ secrets.RBXID }}" ]; then echo 'Missing RBXID secret!'; exit 1; else echo 'Found RBXID secret...'; fi
if [ -z "${{ secrets.PUBLISHCLOUD }}" ]; then echo 'Missing PUBLISHCLOUD secret!'; exit 1; else echo 'Found PUBLISHCLOUD secret...'; fi
- name: Aftman installation
uses: ok-nick/setup-aftman@v0
token: ${{ secrets.GITHUB_TOKEN }}
version: 'v0.2.7'
- name: Package installation
shell: bash
run: wally install
# Testing
- name: Setup Studio cookies
if: github.event.inputs.requireTest == 'true'
run: REG ADD HKCU\Software\RobloxStudioBrowser\ /t REG_SZ /v .RBXID /d "${{ secrets.RBXID }}"
- name: Studio installation
if: github.event.inputs.requireTest == 'true'
uses: OrbitalOwen/roblox-win-installer-action@1.1
cookie: ${{ secrets.ROBLOSECURITY }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
if: github.event.inputs.requireTest == 'true'
shell: bash
run: |
echo 'Running linter...'
selene --config selene.toml src/client src/server src/first src/shared/Util src/shared/Data
echo 'Running tests...'
rojo build tests.project.json -o ./tests/test.rbxl
run-in-roblox --place ./tests/test.rbxl --script ./tests/TestRunner.lua
# Source code processing
- name: Process & minify source code
if: github.event.inputs.shouldProcess == 'true'
continue-on-error: true
shell: bash
run: |
echo 'Removing story files...'
find . -name '*.story.lua' -delete
echo 'Removing test files...'
find . -name '*.spec.lua' -delete
echo 'Processing & minifying source code...'
darklua process src src --format retain-lines
darklua process Packages Packages --format retain-lines
darklua process ServerPackages ServerPackages --format retain-lines
# Deployment
- name: Build the project
shell: bash
run: rojo build default.project.json -o build.rbxl
- name: Upload the build as an action artifact
uses: actions/upload-artifact@v3
name: Project Build
path: build.rbxl
- name: Publish to Roblox
shell: bash
run: |
if [ ${{ }} == 'Production' ]; then universeId=$PRODUCTION_UNIVERSE; else universeId=$TESTING_UNIVERSE; fi
if [ ${{ }} == 'Production' ]; then placeId=$PRODUCTION_PLACE; else placeId=$TESTING_PLACE; fi
echo "Publishing to $universeId/$placeId"
curl --verbose --fail-with-body --location --request POST "$universeId/places/$placeId/versions?versionType=Published" \
--header "x-api-key: ${{ secrets.PUBLISHCLOUD }}" \
--header 'Content-Type: application/octet-stream' \
--data-binary @build.rbxl
Copy link

tatis435 commented Mar 8, 2023


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment