This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 742
192 lines (163 loc) · 6.69 KB
/
internal_release.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: Internal Release
on:
push:
branches:
- main
jobs:
internal_release:
if: |
contains(github.event.head_commit.message, 'Automatic release')
permissions:
contents: write
outputs:
github_release_url: ${{ steps.share_release_url_output.outputs.github_release_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout GIT
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags
- name: Setup Java SDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '18'
- name: Setup Ruby (for Fastlane)
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
- name: Install Fastlane
run: bundle install
#----------------------------------------------------
# Security
- name: Validate Gradle Wrapper checksum
uses: gradle/wrapper-validation-action@v3
- name: Make Gradle Wrapper (gradlew) executable
run: chmod +x gradlew
#----------------------------------------------------
# Optimization
- name: Enable Gradle Wrapper caching (optimization)
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
#---------------------------------------------------
# Decode Secrets for production build
- name: Create JKS for prod signing
run: |
echo "$SIGNING_KEYSTORE_JKS" > sign.jks.b64
base64 -d -i sign.jks.b64 > sign.jks
env:
SIGNING_KEYSTORE_JKS: ${{ secrets.SIGNING_KEYSTORE }}
- name: Create Google Play Config file
run: |
echo "$PLAY_CONFIG_JSON" > play_config.json.b64
base64 -d -i play_config.json.b64 > google-play-console-user.json
env:
PLAY_CONFIG_JSON: ${{ secrets.GOOGLE_PLAY_CONSOLE_JSON }}
#--------------------------------------------------------------------------------
- name: Get version name and code from libs.versions.toml
id: get_version
run: |
VERSION_NAME=$(grep 'version-name =' gradle/libs.versions.toml | awk -F'=' '{print $2}' | tr -d ' "')
VERSION_CODE=$(grep 'version-code =' gradle/libs.versions.toml | awk -F'=' '{print $2}' | tr -d ' "')
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
- name: Create and push tag
env:
PAT_TOKEN: ${{ secrets.IVYWALLET_BOT_GITHUB_PAT_2 }}
run: |
TAG_NAME="v${{ env.VERSION_NAME }}-${{ env.VERSION_CODE }}"
git tag $TAG_NAME
git push https://x-access-token:${{ env.PAT_TOKEN }}@github.com/${{ github.repository }} $TAG_NAME
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
# Fastlane: Build production .aab and release it to Internal Testing
- name: Build production App Bundle
run: bundle exec fastlane production_build
env:
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
- name: Upload App Bundle to GitHub
uses: actions/upload-artifact@v4
with:
name: app-release.aab
path: app/build/outputs/bundle/release/app-release.aab
- name: Release App Bundle to Google PlayStore Internal Testing
run: bundle exec fastlane internal_release
env:
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
#--------------------------------------------------------------------------
- name: Prepare changelog for GitHub Release
uses: Bullrich/generate-release-changelog@master
id: Changelog
env:
REPO: ${{ github.repository }}
- name: Create GitHub Release
if: always() # Execute even if the generation of changelog has failed
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
release_name: Release ${{ env.TAG_NAME }}
body: |
${{ steps.Changelog.outputs.changelog }}
draft: false
prerelease: false
- name: Share GitHub Release URL as output
id: share_release_url_output
run: echo "github_release_url=steps.create_release.outputs.upload_url" >> "$GITHUB_OUTPUT"
upload_apk_and_announce:
runs-on: ubuntu-latest
needs: internal_release
steps:
- name: Checkout GIT
uses: actions/checkout@v4
- name: Setup Java SDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '18'
- name: Make Gradle Wrapper (gradlew) executable
run: chmod +x gradlew
- name: Enable Gradle Wrapper caching (optimization)
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build Demo APK
run: ./gradlew assembleDemo
- name: Upload APK to Github Actions
uses: actions/upload-artifact@v4
with:
name: Ivy-Wallet-Demo.apk
path: app/build/outputs/apk/demo/app-demo.apk
- name: Upload Demo APK to GitHub Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ needs.internal_release.outputs.github_release_url }}
asset_path: app/build/outputs/apk/demo/app-demo.apk
asset_name: Ivy-Wallet-Demo.apk
asset_content_type: application/vnd.android.package-archive
- name: Announce in Telegram group
run: |
RELEASE_TAG=$(echo ${GITHUB_REF} | sed 's/refs\/tags\///')
RELEASE_URL="https://github.com/${GITHUB_REPOSITORY}/releases/tag/${RELEASE_TAG}"
CAPTION=$'🔥 Ivy Wallet '"$RELEASE_TAG"$' release\n\n'"$RELEASE_URL"
curl -F "chat_id=-1001647280565" \
-F "document=@app/build/outputs/apk/demo/app-demo.apk" \
-F "reply_to_message_id=16118" \
-F "caption=$CAPTION" \
https://api.telegram.org/bot${{ secrets.BOTFATHER_TELEGRAM_BOT_TOKEN }}/sendDocument