Skip to content

Commit

Permalink
chore: Update Android workflow to use latest actions and permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
xuanzhi33 committed Jul 20, 2024
1 parent 09d04da commit 0776287
Showing 1 changed file with 9 additions and 38 deletions.
47 changes: 9 additions & 38 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,57 +10,28 @@ on:
jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'

- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x ./Android-app/gradlew

- name: Build with Gradle
run: ./gradlew build
working-directory: ./Android-app

- name: Upload APK
uses: actions/upload-artifact@v2
with:
name: app-release.apk
path: Android-app/app/build/outputs/apk/release/app-release-unsigned.apk

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.sha }}
release_name: Release ${{ github.sha }}
draft: false
prerelease: false

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v2
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: Android-app/app/build/outputs/apk/release/app-release-unsigned.apk
asset_name: app-release-unsigned.apk
asset_content_type: application/vnd.android.package-archive
files: |
Android-app/app/build/outputs/apk/release/app-release-unsigned.apk
tag_name: v0.0.1-android

0 comments on commit 0776287

Please sign in to comment.