Skip to content

Commit

Permalink
ci: automated milestones tracker for kedify-agent chart (#86)
Browse files Browse the repository at this point in the history
* ci: milestones tracker

Signed-off-by: Jan Wozniak <[email protected]>

* ci: kedify-agent chart publish from release

Signed-off-by: Jan Wozniak <[email protected]>

---------

Signed-off-by: Jan Wozniak <[email protected]>
  • Loading branch information
wozniakjan authored and Kedify Bot committed Dec 25, 2024
1 parent ca924ba commit fcf152b
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/milestones-tracker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Milestones Tracker

on:
pull_request:
types: [closed]
paths:
- kedify-agent/**

jobs:
milestone_tracker:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v4
- name: Ensure correct milestone
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
set -euo pipefail
has_milestone=$(gh pr view -R kedify/charts ${PR_NUMBER} --json 'milestone' --jq '.milestone.title | length')
if [[ "$has_milestone" == 0 ]]; then
echo "setting 'kedify-agent/next' milestone for PR #${PR_NUMBER}"
gh pr edit -R kedify/charts ${PR_NUMBER} --milestone "kedify-agent/next"
exit 0
fi
labels=( $(gh pr view -R kedify/charts ${PR_NUMBER} --json 'labels' --jq '.labels[].name') )
for label in "${labels[@]}"; do
if [[ "$label" == "release/kedify-agent" ]]; then
has_release_label="true"
fi
done
if [[ "$has_release_label" != "true" ]]; then
echo "not a release PR #${PR_NUMBER}, labels: ${labels[*]}"
fi
milestone=$(gh pr view -R kedify/charts ${PR_NUMBER} --json 'milestone' --jq '.milestone.title')
echo "release PR #${PR_NUMBER} with milestone: $milestone"
next_milestone_prs=( $(gh pr list -R kedify/charts --search "milestone:kedify-agent/next" --state merged --json number --jq '.[].number') )
for pr in "${next_milestone_prs[@]}"; do
echo "moving PR #$pr milestone 'kedify-agent/next' => '$milestone'"
gh pr edit -R kedify/charts "$pr" --milestone "$milestone"
done
release_tag=${milestone#*/}
pr_body="$(gh pr view $PR_NUMBER --json 'body' --jq '.body')"
echo "creating release $milestone"
gh release create -R kedify/charts "$milestone" --latest --title "kedify-agent: $release_tag" --notes "${pr_body}"
19 changes: 19 additions & 0 deletions .github/workflows/publish-chart-from-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish kedify-agent chart from release

on:
push:
tags:
- 'kedify-agent/v*.*.*'

jobs:
publish-chart:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Publish Helm chart
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.PAT_TOKEN }}
linting: "off"
dependencies: "kedify,https://kedify.github.io/charts"
charts_dir: "."

0 comments on commit fcf152b

Please sign in to comment.