Skip to content

Commit b975bf4

Browse files
committed
apk to release
1 parent 66e834a commit b975bf4

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

.github/workflows/flutter-android.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@ on:
77
branches: [ main, master ]
88
workflow_dispatch:
99

10+
permissions:
11+
contents: write
12+
1013
jobs:
1114
build-android:
1215
name: Build Android APK and AAB
1316
runs-on: ubuntu-latest
1417
steps:
1518
- name: Checkout code
1619
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
1722

1823
- name: Setup Flutter SDK
1924
uses: subosito/flutter-action@v2
@@ -46,3 +51,58 @@ jobs:
4651
name: android-aab
4752
path: platform/build/app/outputs/bundle/release/app-release.aab
4853
retention-days: 7
54+
55+
- name: Extract version from pubspec.yaml
56+
id: get_version
57+
if: github.event_name == 'push'
58+
run: |
59+
VERSION=$(grep '^version:' platform/pubspec.yaml | sed 's/version: //' | sed 's/+.*//')
60+
SHORT_SHA=$(git rev-parse --short HEAD)
61+
TAG_NAME="v${VERSION}-${SHORT_SHA}"
62+
echo "version=$VERSION" >> $GITHUB_OUTPUT
63+
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
64+
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
65+
echo "Version: $VERSION"
66+
echo "Tag: $TAG_NAME"
67+
68+
- name: Create tag
69+
if: github.event_name == 'push'
70+
run: |
71+
git config user.name "github-actions[bot]"
72+
git config user.email "github-actions[bot]@users.noreply.github.com"
73+
git tag -a "${{ steps.get_version.outputs.tag_name }}" -m "Release Flutter Android ${{ steps.get_version.outputs.version }} (commit ${{ steps.get_version.outputs.short_sha }})" || true
74+
git push origin "${{ steps.get_version.outputs.tag_name }}" || true
75+
76+
- name: Create GitHub Release
77+
if: github.event_name == 'push'
78+
uses: softprops/action-gh-release@v1
79+
with:
80+
tag_name: ${{ steps.get_version.outputs.tag_name }}
81+
name: ESP32 Camera Manager Android ${{ steps.get_version.outputs.version }}
82+
body: |
83+
## ESP32 Camera Manager Android ${{ steps.get_version.outputs.version }}
84+
85+
**Commit:** ${{ steps.get_version.outputs.short_sha }}
86+
**Branch:** ${{ github.ref_name }}
87+
88+
### Installation
89+
90+
**APK (Android Package):**
91+
- Download the `app-release.apk` file
92+
- Enable "Install from unknown sources" on your Android device
93+
- Transfer the APK to your device and install it
94+
95+
**AAB (Android App Bundle):**
96+
- Download the `app-release.aab` file
97+
- Upload to Google Play Console for distribution
98+
99+
### Changes
100+
101+
See the [commit history](https://github.com/${{ github.repository }}/compare/${{ github.event.before }}...${{ github.sha }}) for details.
102+
files: |
103+
platform/build/app/outputs/flutter-apk/app-release.apk
104+
platform/build/app/outputs/bundle/release/app-release.aab
105+
draft: false
106+
prerelease: false
107+
env:
108+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)