-
-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (93 loc) · 3.91 KB
/
production_android.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Release Android production version
on:
push:
tags:
- 'v*'
jobs:
build:
name: Test, build and release
runs-on: ubuntu-latest
steps:
##############################################
# setup variables
##############################################
- name: Prepare variables
id: prepare_variables
run: |
semver_regex="^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)$"
BUILD_NAME="${GITHUB_REF:11}"
[[ $BUILD_NAME =~ $semver_regex ]] && echo ::set-output name=build_name::"$BUILD_NAME" || (echo "Build name $BUILD_NAME is not semver" && exit 1);
TIMESTAMP=`date +%s`
echo ::set-output name=build_number::$TIMESTAMP
echo ::set-output name=release_name::"$BUILD_NAME+$TIMESTAMP"
##############################################
# setup actions
##############################################
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
channel: 'beta'
##############################################
# setup-gcloud
##############################################
# the setup-gcloud action seems to need python
- uses: actions/setup-python@v1
with:
python-version: '3.x'
# use setup-gcloud configured with auth credentials
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: '270.0.0'
service_account_email: ${{ secrets.GCS_EMAIL }}
service_account_key: ${{ secrets.GCS_KEY }}
############################################
# download credential files
############################################
- name: Download credential files
run: ./get-credentials.sh
############################################
# test and build the app
############################################
- name: Run Flutter tests
run: |
flutter pub get
flutter test
############################################
# build AAB and upload to the Play Store using Fastlane
############################################
- name: Build AAB
run: flutter build appbundle --build-name=${{ steps.prepare_variables.outputs.build_name }} --build-number=${{ steps.prepare_variables.outputs.build_number }}
- name: Upload to the production track on the Play Store
uses: maierj/[email protected]
with:
lane: 'production'
subdirectory: 'android'
############################################
# build APK and create a prerelase on GitHub
############################################
- name: Build (fat) APK
run: flutter build apk --build-name=${{ steps.prepare_variables.outputs.build_name }} --build-number=${{ steps.prepare_variables.outputs.build_number }}
- name: Create Release
id: create_release
uses: fleskesvor/create-release@feature/support-target-commitish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_name: ${{ steps.prepare_variables.outputs.release_name }}
tag_name: ${{ github.ref }}
commitish: ${{ github.sha }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
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
asset_path: ./build/app/outputs/apk/release/app-release.apk
asset_name: tormented-player-${{ steps.prepare_variables.outputs.release_name }}.apk
asset_content_type: application/vnd.android.package-archive