From 96fac0fe0a4f517530544cd0acba6eb3b67ebe85 Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Mon, 23 Dec 2024 15:21:59 +0100 Subject: [PATCH] add trigger build workflow --- .github/workflows/runner.yml | 2 - .github/workflows/trigger_runner.yml | 128 +++++++++++++++++++++++++++ README.md | 2 + 3 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/trigger_runner.yml diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml index 19a53c7..830df40 100644 --- a/.github/workflows/runner.yml +++ b/.github/workflows/runner.yml @@ -69,7 +69,6 @@ jobs: with: file_path: ${{ github.workspace }}/changelog.json - static-checks: name: 📊 Static checks needs: get-latest-sha @@ -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] diff --git a/.github/workflows/trigger_runner.yml b/.github/workflows/trigger_runner.yml new file mode 100644 index 0000000..ffdbbed --- /dev/null +++ b/.github/workflows/trigger_runner.yml @@ -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[@]}"] + } + }' diff --git a/README.md b/README.md index ff2b218..d563f08 100644 --- a/README.md +++ b/README.md @@ -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 {