-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (136 loc) · 5.88 KB
/
develop-build-apk.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
name: Build app (develop)
on:
push:
branches:
- develop
jobs:
bumpVersion:
runs-on: ubuntu-latest
environment: develop
outputs:
new_tag: ${{ steps.get_version.outputs.new_tag }}
commit_sha: ${{ steps.get_commit_sha.outputs.commit_sha }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Calculate new version
id: get_version
uses: mathieudutour/github-tag-action@v6.1
with:
dry_run: true
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: ""
- name: Update version in pubspec.yaml
run: |
sed -i 's/version: .*/version: ${{ steps.get_version.outputs.new_tag }}/g' pubspec.yaml
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add pubspec.yaml
git diff --quiet && git diff --staged --quiet || git commit -m "Updated version in pubspec.yaml"
- name: Push version changes to develop
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: develop
- name: Resolve commit SHA
id: get_commit_sha
run: echo "::set-output name=commit_sha::$(git rev-parse HEAD)"
- name: Tag version
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
custom_tag: ${{ steps.get_version.outputs.new_tag }}
commit_sha: ${{ steps.get_commit_sha.outputs.commit_sha }}
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: ""
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.get_version.outputs.new_tag }}
name: Release ${{ steps.get_version.outputs.new_tag }}
body: ${{ steps.get_version.outputs.changelog }}
buildAndroid:
runs-on: ubuntu-latest
environment: develop
needs: bumpVersion
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
ref: ${{ needs.bumpVersion.outputs.commit_sha }}
- name: Build APK
uses: subosito/flutter-action@v2
with:
flutter-version: "3.16.0"
channel: "stable"
- run: |
echo ${{ secrets.SIGN_KEYSTORE }} > /tmp/upload-keystore.b64 && base64 -d -i /tmp/upload-keystore.b64 > /tmp/upload-keystore.jks
echo storePassword=${{ secrets.SIGN_STORE_PASSWORD }} >> android/key.properties
echo keyPassword=${{ secrets.SIGN_KEY_PASSWORD }} >> android/key.properties
echo keyAlias=upload >> android/key.properties
echo storeFile=/tmp/upload-keystore.jks >> android/key.properties
echo API_BASE_PATH=${{ secrets.API_BASE_PATH }} >> .env
echo ENVIRONMENT=${{ secrets.ENVIRONMENT }} >> .env
echo MQTT_PASSWORD=${{ secrets.MQTT_PASSWORD }} >> .env
echo MQTT_PORT=${{ secrets.MQTT_PORT }} >> .env
echo MQTT_URL=${{ secrets.MQTT_URL }} >> .env
echo MQTT_USERNAME=${{ secrets.MQTT_USERNAME }} >> .env
echo APP_UPDATES_BASE_URL=${{ secrets.APP_UPDATES_BASE_URL }} >> .env
echo CDN_BASE_URL=${{ secrets.CDN_BASE_URL }} >> .env
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
flutter build apk
mkdir -p update/android/${{ needs.bumpVersion.outputs.new_tag }}
mv build/app/outputs/apk/release/output-metadata.json update/android/output-metadata.json
mv build/app/outputs/apk/release/*.apk update/android/${{ needs.bumpVersion.outputs.new_tag }}/
- name: Upload APK
uses: shallwefootball/s3-upload-action@master
with:
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_bucket: ${{ secrets.UPDATES_BUCKET }}
source_dir: update
destination_dir: "staging/"
## MacOS build is currently handled manually outside of the CI/CD pipeline.
# buildMacOS:
# runs-on: macos-latest
# environment: develop
# needs: bumpVersion
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: true
# fetch-depth: 0
# ref: ${{ needs.bumpVersion.outputs.commit_sha }}
# - name: Build APK
# uses: subosito/flutter-action@v2
# with:
# flutter-version: "3.13.1"
# channel: "stable"
# - run: |
# echo API_BASE_PATH=${{ secrets.API_BASE_PATH }} >> .env
# echo ENVIRONMENT=${{ secrets.ENVIRONMENT }} >> .env
# echo MQTT_PASSWORD=${{ secrets.MQTT_PASSWORD }} >> .env
# echo MQTT_PORT=${{ secrets.MQTT_PORT }} >> .env
# echo MQTT_URL=${{ secrets.MQTT_URL }} >> .env
# echo MQTT_USERNAME=${{ secrets.MQTT_USERNAME }} >> .env
# echo ANDROID_ARCHITECTURE=${{ secrets.ANDROID_ARCHITECTURE }} >> .env
# echo APP_UPDATES_BASE_URL=${{ secrets.APP_UPDATES_BASE_URL }} >> .env
# echo CDN_BASE_URL=${{ secrets.CDN_BASE_URL }} >> .env
# flutter pub get
# flutter pub run build_runner build --delete-conflicting-outputs
# flutter build macos
# mkdir -p update/macos/${{ needs.bumpVersion.outputs.new_tag }}
# echo "${{ needs.bumpVersion.outputs.new_tag }}" > update/macos/version.txt
# mv build/macos/Build/Products/Release/noheva_visitor_ui.app update/macos/${{ needs.bumpVersion.outputs.new_tag }}/
# - name: Upload APP
# uses: shallwefootball/s3-upload-action@master
# with:
# aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws_bucket: ${{ secrets.UPDATES_BUCKET }}
# source_dir: update
# destination_dir: "staging/"