Skip to content

Commit

Permalink
Merge pull request #23 from praveenperera/fix-release
Browse files Browse the repository at this point in the history
Binary distribution: Use Github API to get `OLD_VERSION`
  • Loading branch information
ThePrimeagen committed Sep 27, 2023
2 parents 86d3bf8 + eb0c51b commit d06b367
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,16 @@ jobs:
shell: bash
run: |
RELEASE_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' Cargo.toml)
OLD_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' <<< "$(git show HEAD~1:Cargo.toml)")
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
latest=$(curl https://api.github.com/repos/ThePrimeagen/htmx-lsp/releases/latest)
# no releases, default to 0.0.0
if [[ "$latest" == *"Not Found"* ]]; then
OLD_VERSION="0.0.0"
else
OLD_VERSION=$( echo $latest | grep "tag_name" | cut -d'"' -f4 )
fi
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "$OLD_VERSION -> $RELEASE_VERSION"
if [[ "$RELEASE_VERSION" == "$OLD_VERSION" ]]; then
Expand Down

0 comments on commit d06b367

Please sign in to comment.