twitch-bot/ci/create-workflow.sh
Knut Ahlers 6c941fb330
CI: Concatenate workflow into one workflow
from one file per job through script

Signed-off-by: Knut Ahlers <knut@ahlers.me>
2024-04-07 13:37:13 +02:00

15 lines
451 B
Bash

#!/usr/bin/env bash
set -euo pipefail
target_file=.github/workflows/generated_workflow.yml
source_files=($(find ci/workflow-parts -name 'part_*'))
base=ci/workflow-parts/index.yaml
cp ${base} ${target_file}
for source_file in "${source_files[@]}"; do
job_name=${source_file##*/part_}
job_name=${job_name%%.*}
yq -P ".jobs.${job_name} |= load(\"${source_file}\")" ${target_file} >${target_file}.new
mv ${target_file}.new ${target_file}
done