-
Notifications
You must be signed in to change notification settings - Fork 6
107 lines (91 loc) · 4.45 KB
/
dev-release.yml
File metadata and controls
107 lines (91 loc) · 4.45 KB
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
100
101
102
103
104
105
106
107
name: CD Dev-Lane
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch.
# Repository Secrets needed to execute this workflow
# ==================================================
# GH_TOKEN : https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
# KEYSTORE_JKS_BASE64 : A base64 String of .JKS keystore file. Can be generated by : openssl base64 -A -in android/key.jks
# KEY_PROPERTIES_BASE64 : A base64 String of key.properties file. Can be generated by : openssl base64 -A -in android/key.properties
# MAIL_FROM_NAME : A mailer name (Generally proposed as project developer)
# MAIL_USERNAME : A mailer email username to send email from
# MAIL_PASSWORD : Email password to send email from (For Google mail servers, we need app-specific password : https://myaccount.google.com/apppasswords)
# MAIL_TO : Recipients of the generated build release
on:
push:
branches:
- dev
jobs:
build:
name: Build Artifacts and Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Read pubspec.yaml Version
uses: KJ002/read-yaml@1.5
id: pubspec-data
with:
file: 'pubspec.yaml'
key-path: '["version"]'
- name: Generate unique Release Tag
run: echo RELEASE_TAG=Release-${{ steps.pubspec-data.outputs.data }}-$(date +%s) >> $GITHUB_ENV
- name: Set flavor string
run: echo APP_FLAVOR=dev >> $GITHUB_ENV
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: "11.x"
- name: Setup Flutter
uses: subosito/flutter-action@v1
with:
flutter-version: "2.10.3"
channel: 'stable'
- name: Decode android/key.properties
run: echo "${{ secrets.KEY_PROPERTIES_BASE64 }}" | base64 --decode > android/key.properties
- name: Decode android/neumodore_key.jks
run: echo "${{ secrets.KEYSTORE_JKS_BASE64 }}" | base64 --decode > android/key.jks
- name: Pub Get Packages
run: flutter pub get
- name: Build APPBUNDLE
run: flutter build appbundle --release --flavor ${{env.APP_FLAVOR}} -t lib/main_${{env.APP_FLAVOR}}.dart && flutter build apk --release --flavor ${{env.APP_FLAVOR}} -t lib/main_${{env.APP_FLAVOR}}.dart
- name: Create Github Release
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/bundle/${{env.APP_FLAVOR}}Release/*.aab,build/app/outputs/flutter-apk/app-${{env.APP_FLAVOR}}-release.apk"
token: ${{ secrets.GH_TOKEN }}
tag: "${{env.RELEASE_TAG}}"
body: "${{ github.event.head_commit.message }}"
- name: Save APPBUNDLE to Artifacts
uses: actions/upload-artifact@v2
with:
name: APPBUNDLE
path: build/app/outputs/bundle/${{env.APP_FLAVOR}}Release/app-${{env.APP_FLAVOR}}-release.aab
- name: Save APK to Artifacts
uses: actions/upload-artifact@v2
with:
name: APK
path: build/app/outputs/flutter-apk/app-${{env.APP_FLAVOR}}-release.apk
- name: Send mail
uses: dawidd6/action-send-mail@v3
with:
# Required mail server address:
server_address: smtp.gmail.com
# Required mail server port:
server_port: 465
# Optional (recommended): mail server username:
username: ${{secrets.MAIL_USERNAME}}
# Optional (recommended) mail server password:
password: ${{secrets.MAIL_PASSWORD}}
# Required mail subject:
subject: "New Build is here for ${{github.repository}} - ${{env.RELEASE_TAG}}"
# Required recipients' addresses:
to: ${{secrets.MAIL_TO}}
# Required sender full name (address can be skipped):
from: ${{secrets.MAIL_FROM_NAME}} # <user@example.com>
# Optional whether this connection use TLS (default is true if server_port is 465)
secure: true
# Optional plain body:
body: "Build job of ${{github.repository}} completed successfully! Download the APK for ${{env.RELEASE_TAG}} \nhttps://github.com/${{github.repository}}/releases/download/${{env.RELEASE_TAG}}/app-${{env.APP_FLAVOR}}-release.apk"
# Optional unsigned/invalid certificates allowance:
ignore_cert: true
#attachments: build/app/outputs/flutter-apk/app-release.apk
priority: high