-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ahmed AbouZaid <[email protected]>
- Loading branch information
Showing
12 changed files
with
1,119 additions
and
280 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Generate version matrix | ||
description: Find changed/unchanged versions and generate matrix for them to be used in GHA workflow matrix. | ||
|
||
inputs: | ||
versions-path: | ||
description: Versions path to match. | ||
required: true | ||
|
||
outputs: | ||
matrix-exclude: | ||
description: JSON matrix of unchanged versions which will be used as and input for GHA workflow matrix exclude. | ||
value: ${{ steps.get-versions.outputs.matrix }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Get changed dirs | ||
id: changed-files | ||
uses: tj-actions/changed-files@48d8f15b2aaa3d255ca5af3eba4870f807ce6b3c # v45 | ||
with: | ||
dir_names: "true" | ||
- name: Generate matrix | ||
shell: bash | ||
id: get-versions | ||
env: | ||
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | ||
run: | | ||
echo "Setting matrix based on changed files" | ||
echo "Changed files:" | ||
printf "%s\n" ${ALL_CHANGED_FILES} | ||
touch matrix_versions.txt | ||
ls -d ${{ inputs.versions-path }} | while read version_dir; do | ||
if [[ $(echo ${ALL_CHANGED_FILES} | grep "${version_dir}") ]]; then | ||
continue | ||
else | ||
camunda_version="$(echo ${version_dir} | rev | cut -d '-' -f 1 | rev)"; | ||
echo "Camunda version: ${camunda_version}" | ||
echo "${camunda_version}" >> matrix_versions.txt; | ||
fi | ||
done | ||
# NOTE: The keys "versions" and "camunda-version" are hard coded and should be used in the workflow matrix. | ||
matrix-exclude="$(cat matrix_versions.txt | | ||
jq -s -c -R 'split("\n") | .[:-1] | map({"versions": {"camunda-version": .}})')" | ||
echo "matrix-exclude=${matrix-exclude}" | tee -a $GITHUB_OUTPUT |
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
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
Oops, something went wrong.