mirror of
https://github.com/vleeuwenmenno/supplements.git
synced 2025-09-11 18:29:12 +02:00
feat: Add GitHub Actions workflows for building and releasing Android, iOS, Linux, and Windows applications
This commit is contained in:
69
.github/workflows/android-build.yml
vendored
Normal file
69
.github/workflows/android-build.yml
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
# .github/workflows/release_apk_github.yml
|
||||
name: Build Android Release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Android Release for GitHub
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'vleeuwenmenno' && contains(github.server_url, 'github.com')
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: "17"
|
||||
|
||||
- name: Set up Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: "stable"
|
||||
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
|
||||
- name: Build release APK
|
||||
run: flutter build apk --release
|
||||
|
||||
- name: Extract version
|
||||
id: version
|
||||
run: |
|
||||
APP_VERSION=$(grep 'version:' pubspec.yaml | sed 's/version: //g' | sed 's/+.*//g')
|
||||
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Rename APK
|
||||
run: |
|
||||
mv build/app/outputs/flutter-apk/app-release.apk supplements_${{ env.APP_VERSION }}_android.apk
|
||||
|
||||
- name: Build debug APK
|
||||
run: flutter build apk --debug
|
||||
|
||||
- name: Rename Debug APK
|
||||
run: |
|
||||
mv build/app/outputs/flutter-apk/app-debug.apk supplements_${{ env.APP_VERSION }}_debug.apk
|
||||
|
||||
- name: Debug release information
|
||||
run: |
|
||||
echo "Release tag: ${{ github.event.release.tag_name }}"
|
||||
echo "Release name: ${{ github.event.release.name }}"
|
||||
echo "Release URL: ${{ github.event.release.html_url }}"
|
||||
echo "App version: ${{ env.APP_VERSION }}"
|
||||
|
||||
- name: Upload APKs to GitHub Release
|
||||
run: |
|
||||
gh release upload "${{ github.event.release.tag_name }}" "supplements_${{ env.APP_VERSION }}_android.apk" --clobber
|
||||
gh release upload "${{ github.event.release.tag_name }}" "supplements_${{ env.APP_VERSION }}_debug.apk" --clobber
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
Reference in New Issue
Block a user