Skip to content

Commit

Permalink
add trigger build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Ughuuu committed Dec 23, 2024
1 parent e414b7f commit 96fac0f
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ jobs:
with:
file_path: ${{ github.workspace }}/changelog.json


static-checks:
name: 📊 Static checks
needs: get-latest-sha
Expand Down Expand Up @@ -197,7 +196,6 @@ jobs:
new_patch: ${{ needs.get-latest-sha.outputs.patch }}
new_version: ${{ needs.get-latest-sha.outputs.version_string }}


cleanup:
name: Clean Up
needs: [monoglue-build, windows-build, macos-build, linux-build, android-build, ios-build, get-latest-sha]
Expand Down
128 changes: 128 additions & 0 deletions .github/workflows/trigger_runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Trigger Build

on:
workflow_dispatch:
inputs:
production:
description: 'Is this a production build?'
required: true
type: boolean
default: false
type:
description: 'Build type (e.g., nightly)'
required: true
default: 'nightly'
branch:
description: 'Branch to build from'
required: true
default: 'blazium-dev'
build_template:
description: 'Build templates'
required: true
type: boolean
default: true
build_editors:
description: 'Build editors'
required: true
type: boolean
default: true
build_linux:
description: 'Build for Linux'
required: true
type: boolean
default: true
build_monoglue:
description: 'Build Mono Glue'
required: true
type: boolean
default: true
build_ios:
description: 'Build for iOS'
required: true
type: boolean
default: true
build_macos:
description: 'Build for macOS'
required: true
type: boolean
default: true
build_android:
description: 'Build for Android'
required: true
type: boolean
default: true
build_web:
description: 'Build for Web'
required: true
type: boolean
default: true
build_windows:
description: 'Build for Windows'
required: true
type: boolean
default: true
force:
description: 'Force build'
required: true
type: boolean
default: false

jobs:
dispatch-event:
runs-on: ubuntu-latest
steps:
- name: Send Repository Dispatch Event
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Append selected build types to build_type and build arrays
build_type=()
build=()
deploy=()
if [ "${{ inputs.build_template }}" == "true" ]; then
build_type+=("templates")
deploy+=("templates")
fi
if [ "${{ inputs.build_editors }}" == "true" ]; then
build_type+=("editors")
deploy+=("editors")
fi
if [ "${{ inputs.build_linux }}" == "true" ]; then
build+=("linux")
fi
if [ "${{ inputs.build_monoglue }}" == "true" ]; then
build+=("monoglue")
fi
if [ "${{ inputs.build_ios }}" == "true" ]; then
build+=("ios")
fi
if [ "${{ inputs.build_macos }}" == "true" ]; then
build+=("macos")
fi
if [ "${{ inputs.build_android }}" == "true" ]; then
build+=("android")
fi
if [ "${{ inputs.build_web }}" == "true" ]; then
build+=("web")
fi
if [ "${{ inputs.build_windows }}" == "true" ]; then
build+=("windows")
fi
# Update the curl command with the final payload
curl -X POST \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/${{ github.repository }}/dispatches \
-d '{
"event_type": "trigger_build",
"client_payload": {
"production": ${{ inputs.production }},
"type": "${{ inputs.type }}",
"branch": "${{ inputs.branch }}",
"build_type": ["${build_type[@]}"],
"force": ${{ inputs.force }},
"build": ["${build[@]}"],
"deploy": ["${deploy[@]}"]
}
}'
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Dockerfile for macos will not work because of the build size of the container on

- GHA: `.github/workflows/runner.yml` - Orchestrates builds, deployments, and cleanups for the Blazium Engine across multiple operating systems and configurations. It triggers jobs based on a custom payload, enabling tailored workflows for nightly, template, or editor builds, with support for dynamic branching, versioning, and deployment management.

Note: This workflow can also be triggered using the `.github/workflows/trigger_runner.yml` workflow and giving it inputs.

Example payload to trigger the workflow:
```json
{
Expand Down

0 comments on commit 96fac0f

Please sign in to comment.