Skip to content

Fix Github Workflows #29

Fix Github Workflows

Fix Github Workflows #29

Workflow file for this run

name: Android CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
release:
types: [ created ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: gradle
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew assembleRelease
- name: Upload APK to GitHub Release
if: success() # Only proceed if the build is successful
id: create_release
uses: actions/[email protected]
with:
tag_name: ${{ github.event.release.tag_name }} # You can change this to use a version number from your Gradle file
release_name: ${{ github.event.release.tag_name }}
body_path: release_note.md
prerelease: ${{ github.event.release.prerelease }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: Upload APK asset to Release
if: success() # Only upload if the release was created successfully
uses: actions/[email protected]
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: app/release/uuMusic-${{ github.event.release.tag_name }}.apk
asset_name: "uuMusic-${{ github.event.release.tag_name }}" # You can modify the name as needed
asset_content_type: application/vnd.android.package-archive
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}