-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a Github Actions workflow file for android
- Loading branch information
1 parent
89dfd86
commit bb45a1e
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: App Android Release | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
version: | ||
name: Create version number | ||
runs-on: ubuntu-latest | ||
outputs: | ||
output1: ${{ steps.version.outputs.version }} | ||
output2: ${{ steps.vars.outputs.sha_short }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Fetch all history for all tags and branches | ||
run: | | ||
git fetch --prune --depth=1000 | ||
- name: Create version | ||
id: version | ||
run: echo "version=v$(grep ^version pubspec.yaml |cut -f 2 -d ' '|cut -f 1 -d '+')" >> $GITHUB_OUTPUT | ||
- name: Set outputs | ||
id: vars | ||
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
build: | ||
name: Build APK and Create release | ||
needs: [ version ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '18' | ||
#cache: 'gradle' | ||
- name: Setup Android SDK | ||
uses: android-actions/setup-android@v2 | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
channel : 'stable' | ||
- run: flutter pub get | ||
#- run: flutter test | ||
- run: flutter build apk --release --split-per-abi | ||
- run: flutter build appbundle | ||
- name: Create a Release in GitHub | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: "build/app/outputs/apk/release/*.apk,build/app/outputs/bundle/release/app-release.aab" | ||
token: "${{ secrets.GH_TOKEN }}" | ||
tag: "${{ needs.version.outputs.output1 }}" | ||
commit: "${{ github.sha }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters