Skip to content

Commit

Permalink
Merge pull request #350 from i5okie/feature/fix-chart-release-action
Browse files Browse the repository at this point in the history
Fix Chart Releaser action
  • Loading branch information
esune authored Sep 25, 2023
2 parents 35316a9 + 92e3351 commit 0e9f57d
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions .github/actions/chart_releaser/cr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -248,28 +248,16 @@ install_chart_releaser() {

lookup_latest_tag() {
git fetch --tags >/dev/null 2>&1
latest_tag=$(git tag --sort=-creatordate | sed -n '2p')

if git symbolic-ref --short -q HEAD; then
if ! git describe --tags --abbrev=0 HEAD~ 2>/dev/null; then
git rev-list --max-parents=0 --first-parent HEAD
fi
if [ -z "$latest_tag" ]; then
# If no tags are found, return the initial commit hash
git rev-list --max-parents=0 --first-parent HEAD
else
# In a detached HEAD state, such as when the pipeline
# is triggered by a push on a tag commit, we need to look back
# by date
current_commit=$(git rev-parse HEAD)
for tag in $(git tag --sort=-creatordate); do
if [ $(git rev-parse "$tag") = "$current_commit" ]; then
continue
else
echo "$tag"
break
fi
done
echo "$latest_tag"
fi
}


filter_charts() {
while read -r chart; do
[[ ! -d "$chart" ]] && continue
Expand Down

0 comments on commit 0e9f57d

Please sign in to comment.