Skip to content

StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.

Use app version for GitHub releases

David Nashashb6b4d596cc17
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 95d032c0..9187ba59 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -15,10 +15,32 @@ permissions:
jobs:
build:
runs-on: ubuntu-latest
+ outputs:
+ version_name: ${{ steps.app_version.outputs.version_name }}
+ version_code: ${{ steps.app_version.outputs.version_code }}
+ release_tag: ${{ steps.app_version.outputs.release_tag }}
+ apk_name: ${{ steps.app_version.outputs.apk_name }}
steps:
- uses: actions/checkout@v4
+ - name: Read app version
+ id: app_version
+ shell: bash
+ run: |
+ VERSION_NAME=$(sed -n 's/.*versionName = "\(.*\)".*/\1/p' app/build.gradle.kts | head -n 1)
+ VERSION_CODE=$(sed -n 's/.*versionCode = \([0-9][0-9]*\).*/\1/p' app/build.gradle.kts | head -n 1)
+
+ if [ -z "$VERSION_NAME" ] || [ -z "$VERSION_CODE" ]; then
+ echo "Failed to read app version from app/build.gradle.kts"
+ exit 1
+ fi
+
+ echo "version_name=$VERSION_NAME" >> "$GITHUB_OUTPUT"
+ echo "version_code=$VERSION_CODE" >> "$GITHUB_OUTPUT"
+ echo "release_tag=v$VERSION_NAME" >> "$GITHUB_OUTPUT"
+ echo "apk_name=StreamVault-$VERSION_NAME.apk" >> "$GITHUB_OUTPUT"
+
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
@@ -70,14 +92,14 @@ jobs:
echo "No release APK produced."
exit 1
fi
- cp "$APK_PATH" dist/StreamVault.apk
+ cp "$APK_PATH" "dist/${{ steps.app_version.outputs.apk_name }}"
- name: Upload release APK artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v4
with:
name: release-apk
- path: dist/StreamVault.apk
+ path: dist/${{ steps.app_version.outputs.apk_name }}
- name: Upload test reports
if: always()
@@ -110,13 +132,32 @@ jobs:
name: release-apk
path: dist
+ - uses: actions/checkout@v4
+
+ - name: Read app version
+ id: app_version
+ shell: bash
+ run: |
+ VERSION_NAME=$(sed -n 's/.*versionName = "\(.*\)".*/\1/p' app/build.gradle.kts | head -n 1)
+ VERSION_CODE=$(sed -n 's/.*versionCode = \([0-9][0-9]*\).*/\1/p' app/build.gradle.kts | head -n 1)
+
+ if [ -z "$VERSION_NAME" ] || [ -z "$VERSION_CODE" ]; then
+ echo "Failed to read app version from app/build.gradle.kts"
+ exit 1
+ fi
+
+ echo "version_name=$VERSION_NAME" >> "$GITHUB_OUTPUT"
+ echo "version_code=$VERSION_CODE" >> "$GITHUB_OUTPUT"
+ echo "release_tag=v$VERSION_NAME" >> "$GITHUB_OUTPUT"
+ echo "apk_name=StreamVault-$VERSION_NAME.apk" >> "$GITHUB_OUTPUT"
+
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
- tag_name: master-build-${{ github.run_number }}
- name: Master build #${{ github.run_number }}
+ tag_name: ${{ steps.app_version.outputs.release_tag }}
+ name: StreamVault ${{ steps.app_version.outputs.version_name }}
body: |
- Automated APK build from `${{ github.sha }}`.
- files: dist/StreamVault.apk
+ Version `${{ steps.app_version.outputs.version_name }}` (code `${{ steps.app_version.outputs.version_code }}`) built from `${{ github.sha }}`.
+ files: dist/${{ steps.app_version.outputs.apk_name }}
make_latest: true
generate_release_notes: true
\ No newline at end of file