fdroid.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. name: Fdroid version file generation
  2. on:
  3. workflow_dispatch:
  4. push:
  5. tags:
  6. - 'v[0-9]+.[0-9]+.[0-9]+'
  7. - '[0-9]+.[0-9]+.[0-9]+'
  8. - 'v[0-9]+.[0-9]+.[0-9]+-[0-9]+'
  9. - '[0-9]+.[0-9]+.[0-9]+-[0-9]+'
  10. jobs:
  11. # https://gitlab.com/fdroid/fdroiddata/-/blob/master/metadata/com.carriez.flutter_hbb.yml
  12. # Finds latest release and transforms F-Droid version code from version as follows:
  13. # X.Y.Z-A => X * 1e6 + Y * 1e4 + Z * 1e2 + A
  14. update-fdroid-version-file:
  15. name: Publish RustDesk version file for F-Droid updater
  16. runs-on: ubuntu-latest
  17. steps:
  18. - name: Generate RustDesk version file
  19. run: |
  20. if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
  21. UPSTREAM_VERNAME="${GITHUB_REF##refs/tags/}"
  22. UPSTREAM_VERNAME="${UPSTREAM_VERNAME##v}"
  23. else
  24. UPSTREAM_VERNAME="$(curl https://api.github.com/repos/rustdesk/rustdesk/releases/latest | jq -r .tag_name | sed 's/^v//')"
  25. fi
  26. UPSTREAM_VERCODE="$(echo "$UPSTREAM_VERNAME" | tr '.' ' ' | tr '-' ' ' | while read -r MAJOR MINOR PATCH REV; do [ -z "$MAJOR" ] && MAJOR=0; [ -z "$MINOR" ] && MINOR=0; [ -z "$PATCH" ] && PATCH=0; [ -z "$REV" ] && REV=0; echo "$(( 1000000 * $MAJOR + 10000 * $MINOR + 100 * $PATCH + $REV ))"; done)"
  27. echo "versionName=$UPSTREAM_VERNAME" > rustdesk-version.txt
  28. echo "versionCode=$UPSTREAM_VERCODE" >> rustdesk-version.txt
  29. shell: bash
  30. - name: Publish RustDesk version file
  31. uses: softprops/action-gh-release@v1
  32. with:
  33. prerelease: true
  34. tag_name: "fdroid-version"
  35. files: |
  36. ./rustdesk-version.txt