-
Notifications
You must be signed in to change notification settings - Fork 3
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,117 additions
and
280 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
.github/actions/generate-changed-versions-matrix/action.yml
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,42 @@ | ||
name: Generate version matrix | ||
description: Find changed versions and generate matrix for changed ones only. | ||
|
||
inputs: | ||
versions-path: | ||
description: Versions path to match. | ||
required: true | ||
|
||
outputs: | ||
matrix: | ||
description: JSON matrix of changed versions which will be used as and input for GHA workflow matrix. | ||
value: ${{ steps.set-version-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: set-version-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 | ||
camunda_version="$(echo ${version_dir} | rev | cut -d '-' -f 1 | rev)"; | ||
echo "Camunda version: ${camunda_version}" | ||
echo "${camunda_version}" >> matrix_versions.txt; | ||
fi | ||
done | ||
matrix="$(cat matrix_versions.txt | jq -s -c -R 'split("\n") | .[:-1] | map({"camunda-version": .})')" | ||
echo "matrix=${matrix}" | 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.