forked from trustwallet/wallet-core
-
Notifications
You must be signed in to change notification settings - Fork 6
216 lines (188 loc) · 8.45 KB
/
tangem-publish.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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: Tangem - Publish
run-name: Publish new release with changes from commit '${{ github.event.head_commit.message }}' (${{ github.sha }})
on:
push:
branches:
- 'master'
- 'feature/IOS-8085_migrate_to_xcode_16_1' # TODO: Test only, remove
workflow_dispatch:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DVELOPMENT_ANDROID }}
jobs:
create_tag_and_release:
name: Create tag and release
runs-on: macos-latest
outputs:
publish_version: ${{ steps.version.outputs.tangem }}
swift_protobuf_publish_version: ${{ steps.swift_protobuf_version.outputs.version_tag }}-${{ steps.swift_protobuf_version.outputs.tangem_suffix }}
concurrency:
group: ${{ github.ref }}_create_tag_and_release
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Read version.properties file
uses: BrycensRanch/read-properties-action@6b75d8ab70d5abeb5211f96b660c45c911732b6e # v1.0.4
id: version
with:
file: version.properties
property: tangem
default: 0.0.1-tangem1
- name: Read swift-protobuf-version.properties file
uses: BrycensRanch/read-properties-action@6b75d8ab70d5abeb5211f96b660c45c911732b6e # v1.0.4
id: swift_protobuf_version
with:
file: swift-protobuf-version.properties
all: true
- name: Echo versions
run: |
echo 'Publishing WalletCore version ${{ steps.version.outputs.tangem }}'
echo 'Publishing SwiftProtobuf version ${{ steps.swift_protobuf_version.outputs.version_tag }}-${{ steps.swift_protobuf_version.outputs.tangem_suffix }}'
- name: Create tag and release
uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 # v2.0.5
with:
name: ${{ steps.version.outputs.tangem }}
tag_name: ${{ steps.version.outputs.tangem }}
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: true
prerelease: true # TODO: Test only, remove
publish_ios:
name: Publish iOS
runs-on: macos-latest
outputs:
should_update_swift_protobuf: ${{ env.SHOULD_UPDATE_SWIFT_PROTOBUF }}
concurrency:
group: ${{ github.ref }}_publish_ios
cancel-in-progress: true
needs: create_tag_and_release
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-tags: true # Required otherwise git can't describe the repo; Doesn't actually work w/o 'fetch-depth', see https://github.com/actions/checkout/issues/1471
fetch-depth: 0
- name: Select Xcode version (using `xcodes` utility) from the `.xcode-version` file
run: xcodes select
- name: Remove unused files
run: rm -rf include/TrustWalletCore/TWAnySignerTangem.h # This header is not used on iOS and causes a compilation error
- name: Check if SwiftProtobuf binary must be updated
run: tools/check_if_swift_protobuf_should_be_updated "https://github.com/tangem/swift-protobuf-binaries.git" "${{ needs.create_tag_and_release.outputs.swift_protobuf_publish_version }}"
- name: Install dependencies
uses: ./.github/actions/install_dependencies_composite_action
- name: Generate files
run: tools/generate-files ios
- name: Build XCFramework
run: tools/ios-xcframework
- name: Prepare artefacts
run: |
mkdir -p output/artefacts/wallet-core
mkdir -p output/artefacts/swift-protobuf
mv swift/build/WalletCore.xcframework output/artefacts/wallet-core/
mv swift/build/SwiftProtobuf.xcframework output/artefacts/swift-protobuf/
- name: Upload WalletCore artefacts
uses: actions/upload-artifact@v4
with:
name: wallet-core-binary-artefacts-${{ github.sha }}
path: output/artefacts/wallet-core/
- name: Upload SwiftProtobuf artefacts
uses: actions/upload-artifact@v4
with:
name: swift-protobuf-binary-artefacts-${{ github.sha }}
path: output/artefacts/swift-protobuf/
- name: Upload DSYMs
if: false # TODO: temp disabled, remove
env:
FB_IOS_APP_ID: ${{ secrets.FB_IOS_APP_ID_PROD }}
run: |
# We don't want to have Firebase as a dependency, so we download and use the `upload-symbols` script manually
curl -fsSL https://raw.githubusercontent.com/firebase/firebase-ios-sdk/main/Crashlytics/upload-symbols -o upload-symbols
chmod +x upload-symbols
# The `upload-symbols` script indeed accepts a list of paths to upload, but using it in the foreach loop like this is just a dead-simple approach
find swift/build -type d -name "*.dSYM" -exec ./upload-symbols --platform ios --app-id $FB_IOS_APP_ID {} \;
upload_wallet_core_binaries_ios:
name: Upload WalletCore binaries iOS
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref }}_upload_wallet_core_binaries_ios
cancel-in-progress: true
needs:
- publish_ios
- create_tag_and_release
steps:
- name: Download artefacts
uses: actions/download-artifact@v4
with:
name: wallet-core-binary-artefacts-${{ github.sha }}
path: output
- name: Update wallet-core-binaries-ios repo
if: false # TODO: temp disabled, remove
uses: cpina/github-action-push-to-another-repository@07c4d7b3def0a8ebe788a8f2c843a4e1de4f6900 # v.1.7.2
env:
SSH_DEPLOY_KEY: ${{ secrets.WALLET_CORE_BINARIES_IOS_SSH_DEPLOY_KEY }}
with:
source-directory: 'output/WalletCore.xcframework'
destination-github-username: 'tangem'
destination-repository-name: 'wallet-core-binaries-ios'
target-branch: 'main'
target-directory: 'WalletCore.xcframework'
commit-message: 'Update from ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }} (${{ needs.create_tag_and_release.outputs.publish_version }})'
upload_swift_protobuf_binaries_ios:
name: Upload SwiftProtobuf binaries iOS
if: needs.publish_ios.outputs.should_update_swift_protobuf == 1
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref }}_upload_swift_protobuf_binaries_ios
cancel-in-progress: true
needs:
- publish_ios
- create_tag_and_release
steps:
- name: Download artefacts
uses: actions/download-artifact@v4
with:
name: swift-protobuf-binary-artefacts-${{ github.sha }}
path: output
- name: Update swift-protobuf-binaries repo
if: false # TODO: temp disabled, remove
uses: cpina/github-action-push-to-another-repository@07c4d7b3def0a8ebe788a8f2c843a4e1de4f6900 # v.1.7.2
env:
SSH_DEPLOY_KEY: ${{ secrets.SWIFT_PROTOBUF_BINARIES_SSH_DEPLOY_KEY }}
with:
source-directory: 'output/SwiftProtobuf.xcframework'
destination-github-username: 'tangem'
destination-repository-name: 'swift-protobuf-binaries'
target-branch: 'main'
target-directory: 'SwiftProtobuf.xcframework'
commit-message: 'Update from ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }} (${{ needs.create_tag_and_release.outputs.swift_protobuf_publish_version }})'
publish_android:
name: Publish Android
if: false # TODO: temp disabled, remove
runs-on: macos-13
concurrency:
group: ${{ github.ref }}_publish_android
cancel-in-progress: true
needs: create_tag_and_release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/install_dependencies_composite_action
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Install Android Dependencies
run: tools/install-android-dependencies
- name: Generate files
run: tools/generate-files android
- name: Build and publish Android
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
run: |
cd android/
echo sdk.dir = $ANDROID_HOME > local.properties
GITHUB_USER=${{ secrets.GITHUB_ACTOR }} GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} ./gradlew build assembleRelease publish -Pversion=${{ needs.create_tag_and_release.outputs.publish_version }}