-
Notifications
You must be signed in to change notification settings - Fork 1
120 lines (114 loc) · 4.4 KB
/
build-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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Build and Distribute Android App
concurrency:
group: main
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches: [ develop, main, master ]
jobs:
startSlackNotification:
name: Slack Starting Notification
runs-on: ubuntu-latest
steps:
- run: |
export BUILD_NUM=$((${{ github.run_number }}))
export GITHUB_WORKFLOW_URL=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
echo "BUILD_NUM=$BUILD_NUM" >> $GITHUB_ENV
echo "GITHUB_WORKFLOW_URL=$GITHUB_WORKFLOW_URL" >> $GITHUB_ENV
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: amazon-location-services-builds
SLACK_COLOR: '#FFFF00'
SLACK_ICON_EMOJI: ':hammer:'
SLACK_LINK_NAMES: true
SLACK_TITLE: ${{ format('Android Build №{0} started...', env.BUILD_NUM) }}
SLACK_MESSAGE: |
${{ format('Branch: `{0}`', github.ref_name) }}
SLACK_FOOTER: ${{ github.ref }} | ${{ env.GITHUB_WORKFLOW_URL }}
SLACK_USERNAME: CI/CD Bot
MSG_MINIMAL: true
build-android:
name: Build Android
env:
STORE_FILE_PATH: "../.signing/keystore.jks"
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20'
- name: Setup Bundler
run: |
bundle config --local path ./vendor/bundle
bundle config --local deployment true
bundle install
- name: Setup Signing
working-directory:
run: |
mkdir -p .signing
base64 -d <<< ${{ secrets.KEYSTORE }} > .signing/keystore.jks
base64 -d <<< ${{ secrets.SECRETS }} > custom.properties
ls .signing
- name: Build APK
run: |
export BUILD_NUM=$((${{ github.run_number }}))
echo Building $BUILD_NUM
bundle exec fastlane build_apk version_code:$BUILD_NUM build_type:Release
- name: Distribute APK to firebase
run: |
bundle exec fastlane distribute_firebase \
app_id:${{ secrets.FIREBASE_APP_ID }} \
changelog:"Amazon Location Dev Build" \
firebase_cli_token:${{ secrets.FIREBASE_TOKEN }} \
aab_path:./app/build/outputs/apk/release/app-release.apk
- name: Build AAB
if: false
run: |
export BUILD_NUM=$((${{ github.run_number }}))
echo Building $BUILD_NUM
bundle exec fastlane build_aab version_code:$BUILD_NUM build_type:Release
- name: Distribute AAB to google play
if: false
run: |
bundle exec fastlane distribute_play_store \
package_name:com.aws.amazonlocation \
track:internal \
json_key:./.signing/play_store_key.json \
aab_path:./app/build/outputs/bundle/release/app-release.aab
slackNotification:
name: slack
needs: [
build-android
]
if: always()
runs-on: ubuntu-latest
env:
SUCCESS: ${{ needs.build-android.result == 'success' }}
steps:
- run: |
export BUILD_NUM=$((${{ github.run_number }}))
export GITHUB_WORKFLOW_URL=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
echo "BUILD_NUM=$BUILD_NUM" >> $GITHUB_ENV
echo "GITHUB_WORKFLOW_URL=$GITHUB_WORKFLOW_URL" >> $GITHUB_ENV
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: amazon-location-services-builds
SLACK_COLOR: ${{ env.SUCCESS == 'true' && 'success' || 'failure' }}
SLACK_ICON_EMOJI: ':tophat:'
SLACK_LINK_NAMES: true
SLACK_TITLE: ${{ format('Android build №{0} {1}', env.BUILD_NUM, env.SUCCESS == 'true' && 'finished successfully :tada:' || 'failed!') }}
SLACK_MESSAGE: |
${{ format('Branch: `{0}`', github.ref_name) }}
${{ format('Build Number: `{0}`', env.BUILD_NUM) }}
${{ format('URL: {0}', env.GITHUB_WORKFLOW_URL) }}
SLACK_FOOTER: ${{ github.ref }} | ${{ env.GITHUB_WORKFLOW_URL }}
SLACK_USERNAME: CI/CD Bot
MSG_MINIMAL: true