-
-
Notifications
You must be signed in to change notification settings - Fork 1
146 lines (122 loc) · 5.33 KB
/
prod-workflow.yaml
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Production Workflow
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
flutter_version: "3.16.6"
jobs:
build-apk:
name: "build apk 🔨"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.PE_PRIVATE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PE_PRIVATE_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.PE_AWS_REGION }}
- name: Download credential files
run: |
aws s3 cp s3://${{ secrets.PE_PRIVATE_AWS_S3_BUCKET_NAME }}/credentials/client/paladins-edge-prod.env ./paladins-edge.env
aws s3 cp s3://${{ secrets.PE_PRIVATE_AWS_S3_BUCKET_NAME }}/credentials/client/google-services.json ./android/app/
aws s3 cp s3://${{ secrets.PE_PRIVATE_AWS_S3_BUCKET_NAME }}/credentials/client/upload-keystore.jks ./android/app/
aws s3 cp s3://${{ secrets.PE_PRIVATE_AWS_S3_BUCKET_NAME }}/credentials/client/key.properties ./android/
- name: Including Paladins Assets in this build
run: |
aws s3 sync s3://${{ secrets.PE_PRIVATE_AWS_S3_BUCKET_NAME }}/paladins_assets/ ./paladins_assets/
rm pubspec.yaml
mv pubspec.assets.yaml pubspec.yaml
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: ${{ env.flutter_version }}
- name: Get dependencies
run: flutter pub get
- name: Flutter version
run: flutter --version
- name: Build apk
run: flutter build apk --release --build-number=${{ github.run_number }}
# Run below tasks only if its a push
- name: Get flutter version
if: ${{ github.event_name == 'push' }}
id: flutter_version
uses: NiklasLehnfeld/flutter-version-number-action@main
with:
file-path: ./pubspec.yaml
- name: Bump version and push tag
if: ${{ github.event_name == 'push' }}
id: tag_version
uses: mathieudutour/[email protected]
with:
custom_tag: ${{ steps.flutter_version.outputs.version-number }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create a GitHub release
if: ${{ github.event_name == 'push' }}
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
artifacts: "./build/app/outputs/flutter-apk/app-release.apk"
build-bundle:
name: "build bundle 🛠️"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.PE_PRIVATE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PE_PRIVATE_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.PE_AWS_REGION }}
- name: Download credential files
run: |
aws s3 cp s3://${{ secrets.PE_PRIVATE_AWS_S3_BUCKET_NAME }}/credentials/client/paladins-edge-prod.env ./paladins-edge.env
aws s3 cp s3://${{ secrets.PE_PRIVATE_AWS_S3_BUCKET_NAME }}/credentials/client/google-services.json ./android/app/
aws s3 cp s3://${{ secrets.PE_PRIVATE_AWS_S3_BUCKET_NAME }}/credentials/client/upload-keystore.jks ./android/app/
aws s3 cp s3://${{ secrets.PE_PRIVATE_AWS_S3_BUCKET_NAME }}/credentials/client/key.properties ./android/
- name: Including Paladins Assets in this build
run: |
aws s3 sync s3://${{ secrets.PE_PRIVATE_AWS_S3_BUCKET_NAME }}/paladins_assets/ ./paladins_assets/
rm pubspec.yaml
mv pubspec.assets.yaml pubspec.yaml
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: ${{ env.flutter_version }}
- name: Setup properties
run: |
cat >> "./android/key.properties" <<EOF
storePassword=${{ secrets.FCI_KEYSTORE_PASSWORD }}
keyPassword=${{ secrets.FCI_KEY_PASSWORD }}
keyAlias=${{ secrets.FCI_KEY_ALIAS }}
storeFile=upload-keystore.jks
EOF
- name: Get dependencies
run: flutter pub get
- name: Flutter version
run: flutter --version
- name: Build bundle
run: flutter build appbundle --release --build-number=${{ github.run_number }}
# Run the below tasks only if its a push
- name: Get release notes
if: ${{ github.event_name == 'push' }}
run: git log -1 --pretty="PRODUCTION BUILD - Commit %h%n- Date %cs%n- %s" > release_notes.txt
- name: Upload bundle to app distribution
if: ${{ github.event_name == 'push' }}
uses: wzieba/[email protected]
with:
appId: 1:280154424805:android:06755c7776c617c0aa1b0c
serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
groups: Developers
releaseNotesFile: ./release_notes.txt
file: ./build/app/outputs/bundle/release/app-release.aab