Externalize build triggers and build strategy matrix for reuse in mul… #1
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: Run Workflows | |
on: | |
push: | |
branches: | |
- main | |
- 'release/v[0-9]+\.[0-9]+\.[0-9]+' | |
- "feature/**" | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
branches: | |
- 'release/v[0-9]+\.[0-9]+\.[0-9]+' | |
- "feature/**" | |
# Manual trigger | |
workflow_dispatch: | |
jobs: | |
# YAML anchors are not supported | |
# Write the martix of the build strategy to the output and reuse in subsequent jobs.concurrency | |
define_build_strategy: | |
name: Define build strategy | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
platform: | |
- ubuntu-22.04 | |
- windows-2022 | |
build_type: | |
- "Release" | |
outputs: | |
matrix: ${{ steps.strategy.outputs.matrix }} | |
steps: | |
- name: Define build startegy | |
id: strategy | |
run: | | |
echo "matrix=$( | |
echo '{ | |
"platform": "'"${{ matrix.platform }}"'", | |
"build_type": "'"${{ matrix.build_type }}"'" | |
}' | jq -c -r . | |
)" >> "$GITHUB_OUTPUT" | |
build_dependencies: | |
needs: define_build_strategy | |
strategy: | |
matrix: ${{ fromJSON(needs.define_build_strategy.outputs.matrix) }} | |
uses: ./.github/workflows/build-dependencies.yml | |
with: | |
platform: ${{ matrix.platform }} | |
build_type: ${{ matrix.build_type }} |