-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (141 loc) · 5.83 KB
/
manual_deploy.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Manual Deploy
on:
workflow_dispatch:
inputs:
variant:
type: choice
description: 'live / staging'
required: true
options:
- live
- staging
firebase:
type: boolean
description: Upload artifact to Firebase
slack:
type: boolean
description: Send artifact to slack
slack_message:
type: string
description: Message to send with artifact
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'adopt'
- name: Clean build
run: ./gradlew clean
- name: Setup google-services.json (Live)
if: startsWith(github.event.inputs.variant, 'live')
run: |
mkdir -p ./app/src/live
cat << EOF > ./app/src/live/google-services.json
${{ secrets.google_services_json_live }}
EOF
- name: Setup google-services.json (Staging)
if: startsWith(github.event.inputs.variant, 'staging')
run: |
mkdir -p ./app/src/staging
cat << EOF > ./app/src/staging/google-services.json
${{ secrets.google_services_json_staging }}
EOF
- name: Setup gcp-service-account.json (Live)
if: startsWith(github.event.inputs.variant, 'live')
run: |
cat << EOF > ./gcp-service-account-live.json
${{ secrets.app_distribution_service_account_live }}
EOF
- name: Setup gcp-service-account.json (Staging)
if: startsWith(github.event.inputs.variant, 'staging')
run: |
cat << EOF > ./gcp-service-account-staging.json
${{ secrets.app_distribution_service_account_staging }}
EOF
- name: Setup secrets.xml for app module (Live)
if: startsWith(github.event.inputs.variant, 'live')
run: |
mkdir -p ./app/src/live/res/values
cat << EOF > ./app/src/live/res/values/secrets.xml
${{ secrets.secrets_xml_live }}
EOF
- name: Setup secrets.xml for core:network module (Live)
if: startsWith(github.event.inputs.variant, 'live')
run: |
mkdir -p ./core/network/src/live/res/values
cat << EOF > ./core/network/src/live/res/values/secrets.xml
${{ secrets.secrets_xml_live_core_network }}
EOF
- name: Setup secrets.xml for app module (Staging)
if: startsWith(github.event.inputs.variant, 'staging')
run: |
mkdir -p ./app/src/staging/res/values
cat << EOF > ./app/src/staging/res/values/secrets.xml
${{ secrets.secrets_xml_staging }}
EOF
- name: Setup secrets.xml for core:network module (Staging)
if: startsWith(github.event.inputs.variant, 'staging')
run: |
mkdir -p ./core/network/src/staging/res/values
cat << EOF > ./core/network/src/staging/res/values/secrets.xml
${{ secrets.secrets_xml_staging_core_network }}
EOF
- name: Decode Keystore
env:
ENCODED_STRING: ${{ secrets.KEYSTORE }}
run: |
mkdir -p ./app/keystore
echo $ENCODED_STRING | base64 -di > ./app/keystore/android.jks
- name: Build production apk (Live)
if: startsWith(github.event.inputs.variant, 'live')
run: ./gradlew bundleLiveRelease
env:
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
- name: Build production apk (Staging)
if: startsWith(github.event.inputs.variant, 'staging')
run: ./gradlew assembleStagingRelease
env:
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
- name: Upload artifact to Firebase App Distribution (Live)
if: ${{ github.event.inputs.firebase == 'true' && startsWith(github.event.inputs.variant, 'Live') }}
run: ./gradlew appDistributionUploadLiveRelease
- name: Upload artifact to Firebase App Distribution (Staging)
if: ${{ github.event.inputs.firebase == 'true' && startsWith(github.event.inputs.variant, 'staging') }}
run: ./gradlew appDistributionUploadStagingRelease
- name: Slack Notification
if: ${{ github.event.inputs.slack == 'true' }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: SNUTT Android 빌드 알림
SLACK_MESSAGE: ${{ github.event.inputs.slack_message }}
SLACK_USERNAME: BuildNoti
- name: Slack Upload APK (Live)
if: ${{ github.event.inputs.slack == 'true' && startsWith(github.event.inputs.variant, 'live') }}
uses: MeilCli/slack-upload-file@v3
with:
slack_token: ${{ secrets.SLACK_READ_WRITE_TOKEN }}
channel_id: ${{ secrets.SLACK_DEPLOY_CHANNEL_ID }}
file_path: './app/build/outputs/apk/live/release/app-live-release.apk'
file_name: 'app-live-release.apk'
file_type: 'apk'
initial_comment: 'live-release APK'
- name: Slack Upload APK (Staging)
if: ${{ github.event.inputs.slack == 'true' && startsWith(github.event.inputs.variant, 'staging') }}
uses: MeilCli/slack-upload-file@v3
with:
slack_token: ${{ secrets.SLACK_READ_WRITE_TOKEN }}
channel_id: ${{ secrets.SLACK_DEPLOY_CHANNEL_ID }}
file_path: './app/build/outputs/apk/staging/release/app-staging-release.apk'
file_name: 'app-staging-release.apk'
file_type: 'apk'
initial_comment: 'staging-release APK'