mirror of
https://github.com/localsend/localsend.git
synced 2026-06-23 04:10:07 +00:00
ci: add apk
This commit is contained in:
@@ -5,6 +5,7 @@ on:
|
||||
|
||||
env:
|
||||
FLUTTER_VERSION: "3.7.12"
|
||||
APK_BUILD_DIR: "/tmp/build"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -38,6 +39,62 @@ jobs:
|
||||
name: lib-files
|
||||
path: ./lib/*
|
||||
|
||||
build_apk:
|
||||
needs: build
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Download generated files
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: lib-files
|
||||
path: lib
|
||||
|
||||
- name: Copy files to env.APK_BUILD_DIR
|
||||
run: |
|
||||
mkdir -p $APK_BUILD_DIR
|
||||
cp -r . $APK_BUILD_DIR
|
||||
|
||||
- name: Decode key.properties file
|
||||
working-directory: ${{ env.APK_BUILD_DIR }}
|
||||
env:
|
||||
ENCODED_STRING: ${{ secrets.ANDROID_KEY_PROPERTIES }}
|
||||
run: echo $ENCODED_STRING | base64 -di > android/key.properties
|
||||
|
||||
- name: Decode android-keystore.jks file
|
||||
working-directory: ${{ env.APK_BUILD_DIR }}
|
||||
env:
|
||||
ENCODED_STRING: ${{ secrets.ANDROID_KEY_STORE }}
|
||||
run: mkdir secrets && echo $ENCODED_STRING | base64 -di > secrets/android-keystore.jks
|
||||
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '11'
|
||||
|
||||
- name: Install Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: ${{ env.FLUTTER_VERSION }}
|
||||
|
||||
- name: Dependencies
|
||||
working-directory: ${{ env.APK_BUILD_DIR }}
|
||||
run: flutter pub get
|
||||
|
||||
- name: Build APK
|
||||
working-directory: ${{ env.APK_BUILD_DIR }}
|
||||
run: flutter build apk
|
||||
|
||||
- name: Upload APK
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: apk-result
|
||||
path: ${{ env.APK_BUILD_DIR }}/build/app/outputs/flutter-apk/app-release.apk
|
||||
|
||||
build_tar:
|
||||
needs: build
|
||||
runs-on: ubuntu-20.04
|
||||
@@ -186,7 +243,7 @@ jobs:
|
||||
path: ./*.AppImage
|
||||
|
||||
release:
|
||||
needs: [build, build_tar, build_deb, build_appimage]
|
||||
needs: [build, build_apk, build_tar, build_deb, build_appimage]
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
@@ -201,6 +258,26 @@ jobs:
|
||||
tag: v${{ needs.build.outputs.version }}
|
||||
name: v${{ needs.build.outputs.version }}
|
||||
|
||||
# APK
|
||||
- name: Download apk file
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: apk-result
|
||||
path: apk-result
|
||||
|
||||
- name: Copy apk file to root
|
||||
run: cp apk-result/*.apk result.apk
|
||||
|
||||
- name: Upload Release Asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.draft_release.outputs.upload_url }}
|
||||
asset_path: result.apk
|
||||
asset_name: LocalSend-${{ needs.build.outputs.version }}.apk
|
||||
asset_content_type: application/vnd.android.package-archive
|
||||
|
||||
# TAR.GZ
|
||||
- name: Download tar.gz file
|
||||
uses: actions/download-artifact@v3
|
||||
|
||||
Reference in New Issue
Block a user