Skip to content

Commit

Permalink
[CI] Fix ci releases always failing (#26)
Browse files Browse the repository at this point in the history
* [CI] Fix ci releases always failing

* Revert initial commit to only allow running on master

* Add name for format workflow

* Whoooops, wrong var
  • Loading branch information
MNThomson committed Oct 13, 2023
1 parent 0d74f90 commit b014596
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
run: cargo clippy -- -D warnings

rustfmt:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,15 @@ jobs:
- name: Check if release should be created
shell: bash
run: |
RELEASE_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' Cargo.toml)
latest=$(curl https://api.github.com/repos/ThePrimeagen/htmx-lsp/releases/latest)
set -o pipefail
# 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
RELEASE_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' Cargo.toml)
OLD_VERSION=$( curl -s --fail-with-body https://api.github.com/repos/ThePrimeagen/htmx-lsp/releases/latest | jq -r '.tag_name' )
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "$OLD_VERSION -> $RELEASE_VERSION"
if [[ "$RELEASE_VERSION" == "$OLD_VERSION" ]]; then
if [[ "$RELEASE_VERSION" == "$OLD_VERSION" ]] || ! [[ "$OLD_VERSION" =~ ^[0-9]\.[0-9]\.[0-9]$ ]]; then
echo "SHOULD_RELEASE=no" >> $GITHUB_ENV
else
git tag "$RELEASE_VERSION"
Expand Down

0 comments on commit b014596

Please sign in to comment.