-
Notifications
You must be signed in to change notification settings - Fork 283
69 lines (56 loc) · 2.47 KB
/
os-release-issues.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
name: release-issue-os
on:
workflow_dispatch:
schedule:
- cron: 0 1 * * *
jobs:
list-manifest-versions:
if: github.repository == 'opensearch-project/opensearch-build'
runs-on: ubuntu-latest
outputs:
versions_matrix: ${{ steps.set-matrix.outputs.versions }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
# produces a list of major.minor versions only, no patch versions e.g. ["1.4.0","2.10.0","2.6.0","2.7.0","2.8.0","2.9.0","3.0.0"]
run: echo "versions=$(ls manifests/**/opensearch*.yml | cut -d'/' -f2 | grep '0$' | grep -v '[0-9]0$' | sort | uniq | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
list-components-per-version:
needs: list-manifest-versions
runs-on: ubuntu-latest
outputs:
version_components_matrix: ${{ steps.get-all-components.outputs.combined_matrix }}
steps:
- uses: actions/checkout@v4
- id: get-all-components
run: |
versions_array=${{ needs.list-manifest-versions.outputs.versions_matrix }}
# Remove brackets from the array string
versions_array="${versions_array:1:-1}"
# Split by commas and process each version
IFS=',' read -ra VERSIONS <<< "$versions_array"
# Initialize an array to store all entries
declare -a matrix_entries=()
for version in "${VERSIONS[@]}"; do
# Remove quotes and whitespace from version
version=$(echo $version | tr -d '"' | xargs)
# Get components for this version
components=$(yq eval '.components[].repository' "manifests/$version/opensearch-$version.yml" | \
sed 's/.*\///;s/\.git$//' | \
jq -R -s -c 'split("\n")[:-1]')
# Add this version-components pair to the matrix
matrix_entries+=("{\"version\":\"$version\",\"components\":$components}")
done
# Combine all entries into the final matrix format
matrix_json="{\"include\":[$(IFS=,; echo "${matrix_entries[*]}")]}"
echo "combined_matrix=$matrix_json" >> $GITHUB_OUTPUT
trigger-issue-creation-workflow:
needs: list-components-per-version
strategy:
matrix: ${{ fromJson(needs.list-components-per-version.outputs.version_components_matrix) }}
fail-fast: false
uses: ./.github/workflows/create-release-issues.yml
secrets: inherit
with:
version: ${{ matrix.version }}
repos: ${{ toJson(matrix.components) }}