-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (136 loc) · 5.5 KB
/
release-build.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
145
146
147
148
149
150
name: Library Generate Release
on:
push:
branches: [ master ]
jobs:
generate_release_note:
runs-on: ubuntu-latest
outputs:
msg: ${{ steps.releaseNote.outputs.val }}
steps:
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- uses: actions/checkout@v4
- name: SetUp properties
run: |
echo "keystore.release.file_path=${{ secrets.KEYSTORE_RELEASE_FILE_PATH }}" > local.properties
echo "keystore.release.store_password=${{ secrets.KEYSTORE_RELEASE_PW }}" >> local.properties
echo "keystore.release.key_alias=${{ secrets.KEYSTORE_RELEASE_ALIAS }}" >> local.properties
echo "keystore.release.key_password=${{ secrets.KEYSTORE_RELEASE_KEY_PW }}" >> local.properties
echo "base_url=\"${{ secrets.BASE_URL }}\"" >> local.properties
echo "auth_type=\"${{ secrets.AUTH_TYPE }}\"" >> local.properties
- name: Generate ReleaseNote
id: releaseNote
run: |
./gradlew generateReleaseNote
RELEASE_BODY=$(sed -n '2,$p' appRelease/release_note.txt | less)
RELEASE_BODY="${RELEASE_BODY//'%'/'%'}"
RELEASE_BODY="${RELEASE_BODY//$'\n'/'\n'}"
RELEASE_BODY="${RELEASE_BODY//$'\r'/'\r'}"
echo "val=${RELEASE_BODY}" >> "$GITHUB_OUTPUT"
deploy_firebase:
runs-on: ubuntu-latest
needs: generate_release_note
outputs:
versionCode: ${{ steps.versionInfo.outputs.code }}
versionName: ${{ steps.versionInfo.outputs.name }}
steps:
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- uses: actions/checkout@v4
- name: SetUp properties
run: |
echo "keystore.release.file_path=${{ secrets.KEYSTORE_RELEASE_FILE_PATH }}" > local.properties
echo "keystore.release.store_password=${{ secrets.KEYSTORE_RELEASE_PW }}" >> local.properties
echo "keystore.release.key_alias=${{ secrets.KEYSTORE_RELEASE_ALIAS }}" >> local.properties
echo "keystore.release.key_password=${{ secrets.KEYSTORE_RELEASE_KEY_PW }}" >> local.properties
echo "base_url=\"${{ secrets.BASE_URL }}\"" >> local.properties
echo "auth_type=\"${{ secrets.AUTH_TYPE }}\"" >> local.properties
- name: SetUp Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Execute Fastlane
uses: maierj/fastlane-action@v3.1.0
with:
lane: 'firebaseDeploy'
options: |
{
"build_type": "release",
"release_message": "${{ needs.generate_release_note.outputs.msg }}",
"token": "${{ secrets.FIREBASE_TOKEN }}",
"app_id": "${{ secrets.FIREBASE_RELEASE_APP_ID }}"
}
- name: Generate Version
id: versionInfo
run: |
echo "code=$(./gradlew -q getVersionCode)" >> "$GITHUB_OUTPUT"
echo "name=$(./gradlew -q getVersionName)" >> "$GITHUB_OUTPUT"
gnerate_release:
runs-on: ubuntu-latest
needs: [deploy_firebase, generate_release_note]
steps:
# echo "code=$(grep versionCode buildSrc/src/main/java/Dependencies.kt | awk '{print $5}')" >> "$GITHUB_OUTPUT"
# echo "name=$(grep versionName buildSrc/src/main/java/Dependencies.kt | awk '{print $5}')" >> "$GITHUB_OUTPUT"
# echo "title=$(sed -n -e '1,1p' appRelease/release_note.txt)" >> "$GITHUB_OUTPUT"
# RELEASE_BODY="${RELEASE_BODY//'%'/'%25'}"
# RELEASE_BODY="${RELEASE_BODY//$'\r'/'%0D'}"
- name: Message Parser
id: message_parser
run: |
RELEASE_BODY="${{ needs.generate_release_note.outputs.msg }}"
RELEASE_BODY="${RELEASE_BODY//$'\n'/'<br>'}"
echo "val=${RELEASE_BODY}" >> "$GITHUB_OUTPUT"
- name: Generate Tag
id: tag
run: |
CURRENT_DATE=$(date +"%Y년%m월%d일_%H시%M분")
echo "val=$CURRENT_DATE" >> "$GITHUB_OUTPUT"
- name: Generate Release
uses: ncipollo/release-action@v1.14.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ steps.tag.outputs.val }}
name: ${{ needs.deploy_firebase.outputs.versionName }} (${{ needs.deploy_firebase.outputs.versionCode }})
body: |
## Changes
${{ steps.message_parser.outputs.val }}
slack_notify:
runs-on: ubuntu-latest
needs: [deploy_firebase, generate_release_note]
steps:
- uses: 8398a7/action-slack@v3
with:
status: custom
custom_payload: |
{
text: '[AOS/:til_icon:] 릴리즈 알림',
attachments: [{
color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning',
fields: [
{
title: 'BuildType',
value: 'Release',
short: true
},
{
title: 'Version',
value: '${{ needs.deploy_firebase.outputs.versionName }} (${{ needs.deploy_firebase.outputs.versionCode }})',
short: true
},
{
title: 'Message',
value: '${{ needs.generate_release_note.outputs.msg }}',
short: false
}]
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_AOS_DEPLOY_WEBHOOK_URL }}
if: always()