Skip to content

Commit b800718

Browse files
authored
Add CI for building the app for Android (#51)
* Add CI for building the app for Android * change release config
1 parent c5094a4 commit b800718

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/build_app.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
on:
2+
workflow_dispatch:
3+
inputs:
4+
buildNumber:
5+
description: 'Build Number'
6+
required: true
7+
type: string
8+
versionName:
9+
description: 'Version Name'
10+
required: true
11+
type: string
12+
13+
name: Test, Build and Release apk
14+
15+
jobs:
16+
build:
17+
defaults:
18+
run:
19+
working-directory: ./app
20+
name: Build APK
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: subosito/flutter-action@v2
25+
with:
26+
channel: 'stable'
27+
flutter-version-file: app/pubspec.yaml # path to pubspec.yaml
28+
# write key.properties
29+
#- run: echo "$KEY_PROPERTIES" > android/key.properties
30+
# env:
31+
# KEY_PROPERTIES: ${{ secrets.key_properties }}
32+
# write key.keystore
33+
#- run: mkdir android/key
34+
#- run: echo "$KEY_KEYSTORE" | base64 --decode > android/key/key.keystore
35+
# env:
36+
# KEY_KEYSTORE: ${{ secrets.key_keystore }}
37+
- run: flutter pub get
38+
- run: flutter analyze .
39+
#- run: flutter build apk --build-number $GITHUB_RUN_NUMBER
40+
- run: flutter build apk --build-number ${{ inputs.buildNumber }} --build-name ${{ inputs.versionName }}
41+
- name: Create Release
42+
id: create_release
43+
uses: actions/create-release@v1
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
with:
47+
tag_name: ${{ inputs.buildNumber }}
48+
release_name: Release ${{ inputs.versionName }}-${{ inputs.buildNumber }}
49+
draft: false
50+
prerelease: true
51+
- name: Upload Release APK
52+
id: upload-release-asset
53+
uses: actions/upload-release-asset@v1
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
with:
57+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
58+
asset_path: ./app/build/app/outputs/apk/release/app-release.apk
59+
asset_name: cards.apk
60+
asset_content_type: application/vnd.android.package-archive

0 commit comments

Comments
 (0)