From c93546dc3f9de4b8e623657c2d8a9f6a5b96ec23 Mon Sep 17 00:00:00 2001 From: AbdallahMehiz Date: Sat, 24 Aug 2024 21:07:46 +0100 Subject: [PATCH] ci: add changelogs to preview workflow --- .github/workflows/preview.yml | 47 +++++++++++++++---- .../mehiz/mpvkt/ui/player/PlayerActivity.kt | 2 +- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 8c1e764..d762eca 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -30,6 +30,36 @@ jobs: - name: Make gradlew executable run: chmod +x ./gradlew + - name: Get previous preview + id: last_release + uses: InsonusK/get-latest-release@v1.1.0 + with: + myToken: ${{ github.token }} + exclude_types: "draft" + view_top: 1 + + - name: Prepare build + run: | + set -e + + commit_count=$(git rev-list --count HEAD) + echo "COMMIT_COUNT=$commit_count" >> $GITHUB_ENV + current_sha=$(git rev-parse HEAD) + echo "CURRENT_SHA=$current_sha" >> $GITHUB_ENV + prev_commit_count=$(echo "${{ steps.last_release.outputs.tag_name }}" | sed -e "s/^r//") + commit_count_diff=$(expr $commit_count - $prev_commit_count) + [ $commit_count_diff != 0 ] || exit 1 + commit_count_diff_plus_one=$(expr $commit_count_diff + 1) + prev_release_sha=$(git log --topo-order -n $commit_count_diff_plus_one --skip $commit_count_diff --max-count 1 --pretty=format:"%H") + echo "PREV_RELEASE_SHA=$prev_release_sha" >> $GITHUB_ENV + + echo "COMMIT_LOGS<<{delimiter} + $(curl -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/repos/abdallahmehiz/mpvKt/compare/$prev_release_sha...$current_sha" \ + | jq '[.commits[]|{message:(.commit.message | split("\n")), username:.author.login}]' \ + | jq -r '.[]|"- \(.message | first) (@\(.username))"') + {delimiter}" >> $GITHUB_ENV + - name: Build with Gradle run: ./gradlew assemblePreview @@ -44,13 +74,6 @@ jobs: env: BUILD_TOOLS_VERSION: "34.0.0" - - name: Prepare release - run: | - set -e - - echo "COMMIT_COUNT=$(git rev-list --count HEAD)" >> $GITHUB_ENV - echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - - name: Copy build artifacts run: | set -e @@ -68,13 +91,21 @@ jobs: tag_name: r${{ env.COMMIT_COUNT }} name: mpvKt Preview r${{ env.COMMIT_COUNT }} body: | + ### Commits + + https://github.com/abdallahmehiz/mpvKt/compare/${{ env.PREV_RELEASE_SHA }}...${{ env.CURRENT_SHA }} + + ${{ env.COMMIT_LOGS }} + + --- + ### Checksums | Variant | SHA-256 | | ------- | ------- | - | Universal | ${{ env.apk-universal-sha256 }} | arm64-v8a | ${{ env.apk-arm64-v8a-sha256 }} | armeabi-v7a | ${{ env.apk-armeabi-v7a-sha256 }} + | Universal | ${{ env.apk-universal-sha256 }} | x86 | ${{ env.apk-x86-sha256 }} | x86_64 | ${{ env.apk-x86_64-sha256 }} | files: | diff --git a/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerActivity.kt b/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerActivity.kt index 054ec37..0453184 100644 --- a/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerActivity.kt +++ b/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerActivity.kt @@ -576,7 +576,7 @@ class PlayerActivity : AppCompatActivity() { val height = it val width = it * player.getVideoOutAspect()!! val rational = Rational(height, width.toInt()).toFloat() - if (rational in 0.41..2.40) builder.setAspectRatio(Rational(width.toInt(), height)) + if (rational in 0.42..2.38) builder.setAspectRatio(Rational(width.toInt(), height)) } return builder.build() }