Browse Source

Fixed release script breaking if there is no previous version

This can't actually happen in the current state of the littlefs GitHub
repo, but could in theory cause problems if CI is enabled on a fork.

Found while enabling GitHub Actions on littlefs-fuse.
Christopher Haster 2 years ago
parent
commit
96fb8bec85
1 changed files with 4 additions and 1 deletions
  1. 4 1
      .github/workflows/release.yml

+ 4 - 1
.github/workflows/release.yml

@@ -81,7 +81,9 @@ jobs:
       - name: find-prev-version
       - name: find-prev-version
         continue-on-error: true
         continue-on-error: true
         run: |
         run: |
-          LFS_PREV_VERSION="$(git describe --tags --abbrev=0 --match 'v*')"
+          LFS_PREV_VERSION="$( \
+            git describe --tags --abbrev=0 --match 'v*' \
+            || true)"
           echo "LFS_PREV_VERSION=$LFS_PREV_VERSION"
           echo "LFS_PREV_VERSION=$LFS_PREV_VERSION"
           echo "LFS_PREV_VERSION=$LFS_PREV_VERSION" >> $GITHUB_ENV
           echo "LFS_PREV_VERSION=$LFS_PREV_VERSION" >> $GITHUB_ENV
 
 
@@ -240,6 +242,7 @@ jobs:
         run: |
         run: |
           # create release and patch version tag (vN.N.N)
           # create release and patch version tag (vN.N.N)
           # only draft if not a patch release
           # only draft if not a patch release
+          touch release.txt
           [ -e table.txt ] && cat table.txt >> release.txt
           [ -e table.txt ] && cat table.txt >> release.txt
           echo >> release.txt
           echo >> release.txt
           [ -e changes.txt ] && cat changes.txt >> release.txt
           [ -e changes.txt ] && cat changes.txt >> release.txt