updateLibraryHash.sh 1000 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. #
  3. # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  4. # SPDX-FileCopyrightText: 2024 Tobias Kaminsky <tobias@kaminsky.me>
  5. # SPDX-License-Identifier: GPL-3.0-or-later
  6. latestCommit=$(curl -s https://api.github.com/repos/nextcloud/android-library/commits/master | jq .sha | sed s'/\"//g')
  7. currentCommit=$(grep "androidLibraryVersion" build.gradle | cut -f2 -d'"')
  8. git fetch
  9. git checkout master
  10. git pull
  11. [[ $latestCommit == "$currentCommit" ]] && exit # nothing to do
  12. git fetch
  13. git checkout -B update-library-"$(date +%F)" origin/master
  14. sed -i s"#androidLibraryVersion\ =.*#androidLibraryVersion =\"$latestCommit\"#" build.gradle
  15. ./gradlew --console=plain --dependency-verification lenient -q --write-verification-metadata sha256,pgp help
  16. git add build.gradle
  17. git add gradle/verification-metadata.xml
  18. git commit -s -m "Update library"
  19. gh pr create --head "$(git branch --show-current)" --title "Update library $(date +%F)" --body "Update library to latest commit"