Skip to content

Instantly share code, notes, and snippets.

@NobleDraconian
Last active December 8, 2023 07:28
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NobleDraconian/59cdb840763608e160798307f134b0b0 to your computer and use it in GitHub Desktop.
Save NobleDraconian/59cdb840763608e160798307f134b0b0 to your computer and use it in GitHub Desktop.
Roblox - CI for automated game deployments

Automated game deployment instructions

  1. Tag a commit in the repository with the format of v*.*.* for production releases, and a tag of v*.*.*-qa.* for QA / test releases. For example, v1.6.2-qa.3.
  2. Push the tag to origin
  3. The release.yml action should create a draft release, with the game's rbxl file automatically attached to it.
  4. Add a description to the draft release. Typically this will be release notes.
  5. Publish the release as either a full release or a pre-release.
  6. The deploy.yml action will deploy the place file to either your production environment or your test environment, depending on the naming of the tag.
  7. Your game is now deployed to the proper environment!

Lints will automatically occur when a pull request targeting the master or v*.*.* branches is filed, and when a commit is pushed to those branches

on:
release:
types: [published]
jobs:
game-deploy:
name: Deploy game to proper environment
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
- name: Create temp directory
run: mkdir Temp
- name: Download game build
uses: i3h/download-release-asset@6a9870c8f1c561f9e67550d6177c31c2b1c49fef
with:
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
tag: ${{ github.ref_name }}
file: /Build_*.*.*.rbxl/
path: Temp/
token: ${{ secrets.GITHUB_TOKEN }}
- name: Rename game build to known name
run: mv Temp/Build_v*.*.*.rbxl Temp/GameBuild.rbxl
- name: Deploy game to test environment
if: contains(github.ref_name,'-qa.')
run: |
curl --verbose --location --request \
POST 'https://apis.roblox.com/universes/v1/${{ secrets.TEST_UNIVERSE_ID }}/places/${{ secrets.TEST_PLACE_ID }}/versions?versionType=Published' \
--header "x-api-key:${{ secrets.TEST_DEPLOY_KEY }}" \
--header "Content-Type: application/octet-stream" \
--data-binary @Temp/GameBuild.rbxl
- name: Deploy game to production environment
if: contains(github.ref_name,'-qa.') == false
run: |
curl --verbose --location --request \
POST 'https://apis.roblox.com/universes/v1/${{ secrets.PROD_UNIVERSE_ID }}/places/${{ secrets.PROD_PLACE_ID }}/versions?versionType=Published' \
--header "x-api-key:${{ secrets.PROD_DEPLOY_KEY }}" \
--header "Content-Type: application/octet-stream" \
--data-binary @Temp/GameBuild.rbxl
name: Lua linting
on:
push:
branches:
- 'v*.*.*'
- master
paths:
- 'src/**'
pull_request:
branches:
- 'v*.*.*'
- master
paths:
- 'src/**'
jobs:
selene-lint:
name: Lint src/
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Setup foreman
uses: rojo-rbx/setup-foreman@6d3c8043db88319f8482262680b37f73595a8686
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name : Run selene
run: |
selene src/
name : Game release
on:
push:
tags:
- 'v*'
jobs:
release:
name: Create game release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
- name: Setup foreman
uses: rojo-rbx/setup-foreman@6d3c8043db88319f8482262680b37f73595a8686
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build project
run: |
mkdir Temp
echo ${{ github.ref_name }} >> Temp/GameVersion.txt
rojo build default.project.json --output Temp/CurrentBuild.rbxl
- name: Create release
id: create_release
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
- name: Upload release assets
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Temp/CurrentBuild.rbxl
asset_name: Build_${{ github.ref_name }}.rbxl
asset_content_type: application/octet-stream
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment