Trigger Build #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_type: | |
description: 'Build type (comma-separated list like templates, editors)' | |
required: true | |
type: string | |
default: 'templates,editors' | |
build: | |
description: 'Platforms to build for (comma-separated list like linux, monoglue, ios, macos, android, web, windows)' | |
required: true | |
type: string | |
default: 'linux,ios,macos,android,web,windows,monoglue' | |
force: | |
description: 'Force build?' | |
required: true | |
type: boolean | |
default: true | |
deploy: | |
description: 'Build type (comma-separated list like templates, editors)' | |
required: true | |
type: string | |
default: 'templates,editors' | |
jobs: | |
dispatch-event: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
actions: write | |
steps: | |
- name: Send Repository Dispatch Event | |
run: | | |
# Convert the comma-separated string inputs into arrays | |
build_type=$(printf '%s' '${{ inputs.build_type }}' | jq -R -c 'split(",")') | |
build=$(printf '%s' '${{ inputs.build }}' | jq -R -c 'split(",")') | |
deploy=$(printf '%s' '${{ inputs.deploy }}' | jq -R -c 'split(",")') | |
echo $build_type | |
echo $build | |
echo $deploy | |
# Send the repository dispatch event | |
curl -X POST \ | |
-v \ | |
-H "Accept: application/vnd.github.everest-preview+json" \ | |
-H "Authorization: token ${{ secrets.PRIVATE_GITHUB_PAT }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
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 | |
} | |
}" |