check-operator-sdk-release #421
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: check-operator-sdk-release | |
on: | |
pull_request: | |
paths: | |
- .github/workflows/check-operator-sdk-release.yml | |
schedule: | |
- cron: '0 9 * * *' # 18:00 JST | |
env: | |
VERSION: v1.27.0 | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: check | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
latest_version=$(curl --silent "https://api.github.com/repos/operator-framework/operator-sdk/releases" | jq -r '.[].tag_name' | head -10 | sort -r | head -1) | |
current_minor_version="${VERSION%.*}" | |
latest_minor_version="${latest_version%.*}" | |
echo "current_minor_version: $current_minor_version, latest_minor_version: $latest_minor_version" | |
if [ "$current_minor_version" = "$latest_minor_version" ]; then | |
echo "latest (current: $VERSION, latest: $latest_version)" | |
else | |
echo 'new release exists' | |
title="Upgrade operator-sdk to $latest_version" | |
issue_cnt=$(gh issue list --search "$title" --json 'id' | jq length) | |
if [ "$issue_cnt" -gt 0 ];then | |
echo "issue already exists" | |
else | |
gh issue create --title "$title" --body "operator-sdk $latest_version has been released." --assignee nakamasato | |
fi | |
fi |