1
0

version-check.yml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. name: Version Check
  2. # Guards against the VERSION file drifting from the release tag.
  3. # The web UI reports the current version by reading VERSION and comparing it to
  4. # the latest GitHub release tag, so a tag cut before the VERSION bump lands makes
  5. # every user see a permanent "update available" (see issue #141).
  6. on:
  7. push:
  8. tags: [ 'v*' ]
  9. workflow_dispatch:
  10. jobs:
  11. version-matches-tag:
  12. runs-on: ubuntu-latest
  13. steps:
  14. - name: Checkout repository
  15. uses: actions/checkout@v4
  16. - name: Compare VERSION file against tag
  17. run: |
  18. tag_version="${GITHUB_REF_NAME#v}"
  19. file_version="$(tr -d '[:space:]' < VERSION)"
  20. echo "Tag: $GITHUB_REF_NAME (version $tag_version)"
  21. echo "VERSION file: $file_version"
  22. if [ "$file_version" != "$tag_version" ]; then
  23. echo "::error file=VERSION::VERSION is '$file_version' but tag $GITHUB_REF_NAME expects '$tag_version'"
  24. echo ""
  25. echo "The tag was cut before the VERSION bump landed. To fix:"
  26. echo " 1. echo $tag_version > VERSION && git commit -am 'chore: bump version to $tag_version'"
  27. echo " 2. git tag -f $GITHUB_REF_NAME && git push --force origin $GITHUB_REF_NAME"
  28. echo " 3. Re-publish the release from the corrected tag"
  29. exit 1
  30. fi
  31. echo "VERSION matches the release tag."