Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ jobs:
else
echo "Unpushed commits found."
echo "changes_exist=true" >> "$GITHUB_ENV"
{
echo "tags<<EOF"
git rev-list --reverse origin/main..HEAD |
while IFS= read -r commit; do
git tag --points-at "$commit"
done
echo "EOF"
} >> "$GITHUB_OUTPUT"
fi

- name: push changes if they exist
Expand All @@ -45,14 +53,27 @@ jobs:
git push origin HEAD:refs/heads/main
git push origin HEAD:refs/heads/main --tags

- name: create release on new tag if new changes exist
- name: create releases for new tags
if: env.changes_exist == 'true'
run: |
TAG_NAME=$(git describe --tags "$(git rev-list --tags --max-count=1)")
echo "$TAG_NAME"
gh release create "$TAG_NAME" \
--title "$TAG_NAME" \
--notes "See: https://github.com/astral-sh/ruff/releases/tag/${TAG_NAME/v}" \
--latest
latest_tag=$(printf '%s\n' "$NEW_TAGS" | tail -n 1)

while IFS= read -r tag_name; do
if [ -z "$tag_name" ]; then
continue
fi

latest_flag="--latest=false"
if [ "$tag_name" = "$latest_tag" ]; then
latest_flag="--latest"
fi

gh release create "$tag_name" \
--title "$tag_name" \
--notes "See: https://github.com/astral-sh/ruff/releases/tag/${tag_name#v}" \
--verify-tag \
"$latest_flag"
done <<< "$NEW_TAGS"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEW_TAGS: ${{ steps.check_unpushed.outputs.tags }}