update.sh 815 B

1234567891011121314151617181920212223242526272829
  1. #! /bin/bash
  2. set -x
  3. set -e
  4. git submodule foreach git pull origin master --ff-only
  5. bin/uaparser ua-parser:convert uap-core/regexes.yaml
  6. if [[ ! `git status --porcelain` ]]; then
  7. echo "No resource update necessary"
  8. else
  9. ./vendor/bin/phpunit
  10. git config --global user.email 'github-actions[bot]@users.noreply.github.com'
  11. git config --global user.name "github-actions[bot]"
  12. git fetch --tags
  13. git status
  14. git commit -m "Automatic resource update" uap-core resources/regexes.php
  15. git push
  16. new_version=`git tag | sort --version-sort | tail -n 1 | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{if(length($NF+1)>length($NF))$(NF-1)++; $NF=sprintf("%0*d", length($NF), ($NF+1)%(10^length($NF))); print}'`
  17. git tag $new_version
  18. git push --tags
  19. echo "$new_version published"
  20. fi