release-issue-os #22
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
--- | |
name: release-issue-os | |
on: | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: Log level | |
required: true | |
default: warning | |
type: choice | |
options: | |
- info | |
- warning | |
- debug | |
jobs: | |
list-manifest-versions: | |
if: github.repository == 'prudhvigodithi/opensearch-build' | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: prudhvigodithi/opensearch-build | |
ref: public | |
- 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/2.11.0/opensearch-2.11.0.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: job-scheduler} | |
release_version: ${{ fromJson(needs.list-manifest-versions.outputs.matrix) }} | |
steps: | |
- 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: prudhvigodithi/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: prudhvigodithi/${{ 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: prudhvigodithi/${{ 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_ISSUE_NUMBER=$(echo "${{ steps.check_if_build_repo_issue_exists.outputs.issues }}" | 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_VERSION_X}}|${RELEASE_VERSION_X}|g" "$file_path" > "$file_path.tmp" && mv "$file_path.tmp" "$file_path" |