forked from opensearch-project/opensearch-build
-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (121 loc) · 4.99 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---
name: release-issue-os
on:
workflow_dispatch:
inputs:
logLevel:
description: Log level
required: true
default: warning
type: choice
options:
- info
- warning
- debug
schedule:
- cron: 0 1 * * *
jobs:
list-manifest-versions:
if: github.repository == 'opensearch-project/opensearch-build'
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
with:
repository: opensearch-project/opensearch-build
ref: main
- id: set-matrix
# produces a list of major 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 "::set-output name=matrix::$(ls manifests/**/opensearch*.yml | cut -d'/' -f2 | grep '0$' | grep -v '[0-9]0$' | sort | uniq | jq -R -s -c 'split("\n")[:-1]')"
component-release-issue:
needs: list-manifest-versions
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
entry:
- {repo: OpenSearch}
- {repo: alerting}
- {repo: anomaly-detection}
- {repo: asynchronous-search}
- {repo: common-utils}
- {repo: cross-cluster-replication}
- {repo: geospatial}
- {repo: index-management}
- {repo: job-scheduler}
- {repo: k-NN}
- {repo: neural-search}
- {repo: ml-commons}
- {repo: notifications}
- {repo: observability}
- {repo: performance-analyzer}
- {repo: performance-analyzer-rca}
- {repo: reporting}
- {repo: security}
- {repo: security-analytics}
- {repo: sql}
- {repo: custom-codecs}
- {repo: flow-framework}
- {repo: skills}
- {repo: query-insights}
- {repo: opensearch-system-templates}
release_version: ${{ fromJson(needs.list-manifest-versions.outputs.matrix) }}
steps:
- name: GitHub App token
id: github_app_token
uses: tibdex/github-app-token@v1.6.0
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
installation_id: 22958780
- name: Checkout
uses: actions/checkout@v3
- name: Check if build repo release issue exists
id: check_if_build_repo_issue_exists
uses: actions-cool/issues-helper@v3
with:
actions: 'find-issues'
repo: opensearch-project/opensearch-build
token: ${{ steps.github_app_token.outputs.token }}
issue-state: 'open'
title-includes: '[RELEASE] Release version ${{ matrix.release_version }}'
- name: Check out plugin repo
uses: actions/checkout@v3
with:
path: plugin-repo
repository: opensearch-project/${{ matrix.entry.repo }}
- name: Check if plugin repo release issue exists
if: steps.check_if_build_repo_issue_exists.outputs.issues != '[]'
id: check_if_plugin_repo_issue_exists
uses: actions-cool/issues-helper@v3
with:
actions: 'find-issues'
repo: opensearch-project/${{ matrix.entry.repo }}
token: ${{ steps.github_app_token.outputs.token }}
title-includes: '[RELEASE] Release version ${{ matrix.release_version }}'
- name: Replace Placeholders
if: steps.check_if_plugin_repo_issue_exists.outputs.issues == '[]'
run: |
# Read the file contents and replace the placeholders
file_path="../opensearch-build/.github/ISSUE_TEMPLATE/component_release_template.md"
RELEASE_VERSION="${{ matrix.release_version }}"
RELEASE_BRANCH=$(echo ${{ matrix.release_version }} | cut -d. -f1-2)
BUILD_REPO_ISSUE_OUTPUT=$(cat <<EOF
${{ steps.check_if_build_repo_issue_exists.outputs.issues }}
EOF
)
RELEASE_ISSUE_NUMBER=$(echo $BUILD_REPO_ISSUE_OUTPUT | jq -r '.[0].number')
RELEASE_ISSUE="https://github.com/opensearch-project/opensearch-build/issues/${RELEASE_ISSUE_NUMBER}"
RELEASE_VERSION_X=$(echo "${{ matrix.release_version }}" | awk -F'.' '{print $1}').x
sed -e "s|{{RELEASE_VERSION}}|${RELEASE_VERSION}|g" -e "s|{{RELEASE_ISSUE}}|${RELEASE_ISSUE}|g" -e "s|{{RELEASE_BRANCH}}|${RELEASE_BRANCH}|g" -e "s|{{RELEASE_VERSION_X}}|${RELEASE_VERSION_X}|g" "$file_path" > "$file_path.tmp" && mv "$file_path.tmp" "$file_path"
- name: Create component release issue from file
if: steps.check_if_plugin_repo_issue_exists.outputs.issues == '[]'
uses: peter-evans/create-issue-from-file@v4
with:
title: '[RELEASE] Release version ${{ matrix.release_version }}'
content-filepath: ../opensearch-build/.github/ISSUE_TEMPLATE/component_release_template.md
labels: |
v${{ matrix.release_version }}
token: ${{ steps.github_app_token.outputs.token }}
repository: opensearch-project/${{ matrix.entry.repo }}