mirror of
https://github.com/cmclark00/TetriStats.git
synced 2025-05-17 22:55:21 +01:00
Update workflow to build release APK and create GitHub releases
This commit is contained in:
parent
313db4ee3b
commit
ad18d34cd0
1 changed files with 50 additions and 8 deletions
58
.github/workflows/build.yml
vendored
58
.github/workflows/build.yml
vendored
|
@ -1,10 +1,10 @@
|
|||
name: Build Android APK
|
||||
name: Build and Release Android APK
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
pull_request:
|
||||
branches: [ main, master ]
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
@ -24,11 +24,53 @@ jobs:
|
|||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew assembleDebug
|
||||
- name: Build Release APK
|
||||
run: ./gradlew assembleRelease
|
||||
|
||||
- name: Upload APK
|
||||
- name: Upload APK as artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: app-debug
|
||||
path: app/build/outputs/apk/debug/app-debug.apk
|
||||
name: app-release
|
||||
path: app/build/outputs/apk/release/app-release-unsigned.apk
|
||||
|
||||
- name: Get version name from build.gradle
|
||||
id: version
|
||||
run: |
|
||||
VERSION_NAME=$(grep -o 'versionName = "[^"]*' app/build.gradle.kts | cut -d'"' -f2)
|
||||
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
|
||||
echo "APP_VERSION=$VERSION_NAME" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
name: Release ${{ env.VERSION_NAME }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
files: app/build/outputs/apk/release/app-release-unsigned.apk
|
||||
body: |
|
||||
TetriStats Android App Release v${{ env.VERSION_NAME }}
|
||||
|
||||
Automatically generated release from GitHub Actions.
|
||||
|
||||
Download the APK from the assets below.
|
||||
|
||||
- name: Create Release on Push
|
||||
id: create_release_on_push
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.event_name == 'push' }}
|
||||
uses: softprops/action-gh-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: v${{ env.VERSION_NAME }}-${{ github.run_number }}
|
||||
name: Release v${{ env.VERSION_NAME }}-${{ github.run_number }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
files: app/build/outputs/apk/release/app-release-unsigned.apk
|
||||
body: |
|
||||
TetriStats Android App Release v${{ env.VERSION_NAME }}-${{ github.run_number }}
|
||||
|
||||
Automatically generated release from GitHub Actions.
|
||||
|
||||
Download the APK from the assets below.
|
Loading…
Add table
Add a link
Reference in a new issue