forked from RGB-Tools/iris-wallet-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
299 lines (250 loc) · 10.9 KB
/
iris-wallet-desktop.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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
name: Iris Wallet Desktop CI
on:
push:
tags:
- '*' # Trigger this workflow on any tag push
jobs:
build-iris-wallet-desktop-linux:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v3
with:
submodules: true # Include submodules in the checkout
fetch-depth: 1 # Fetch the latest commit only
- name: Validate Tag and Code Version
run: |
TAG_VERSION=$(git describe --tags)
echo "TAG_VERSION=${TAG_VERSION}" >> $GITHUB_ENV
# Extract version from tag
echo "Tag version: $TAG_VERSION"
# Extract version from code
CODE_VERSION=$(grep '__version__' ./src/version.py | awk -F'=' '{print $2}' | tr -d ' "' | xargs)
echo "Code version: $CODE_VERSION"
# Compare the tag and code version
if [ "$TAG_VERSION" != "$CODE_VERSION" ]; then
echo "❌ Tag version ($TAG_VERSION) does not match code version ($CODE_VERSION)."
exit 1
else
echo "✅ Tag version matches code version."
fi
- name: Install Rust Programming Environment
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
source "$HOME/.cargo/env"
- name: Set up Python 3.12.3 environment
uses: actions/setup-python@v5
with:
python-version: "3.12.3"
- name: Install required system dependencies
run: |
sudo apt update
sudo apt install libxcb-cursor0 -y # Required by the application
sudo apt-get install ruby-dev build-essential -y && sudo gem i fpm -f
sudo apt-get update && sudo apt-get install -y libfuse2 # Required for AppImage creation
- name: Clone rgb-lightning-node repository with submodules
run: git clone https://github.com/RGB-Tools/rgb-lightning-node --recurse-submodules --shallow-submodules
- name: Build the rgb-lightning-node binary
working-directory: rgb-lightning-node
run: cargo install --locked --debug --path .
- name: Copy rgb-lightning-node binary to root directory
run: |
mkdir ln_node_binary
cp rgb-lightning-node/target/debug/rgb-lightning-node ln_node_binary
- name: Set environment variables from GitHub Secrets and generate config.py
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
PROJECT_ID: ${{ secrets.PROJECT_ID }}
AUTH_URI: ${{ secrets.AUTH_URI }}
TOKEN_URI: ${{ secrets.TOKEN_URI }}
AUTH_PROVIDER_CERT_URL: ${{ secrets.AUTH_PROVIDER_CERT_URL }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
run: |
cd src/utils
python generate_config.py
- name: Install Python dependencies
run: |
pip install poetry # Dependency management tool
pip install pyinstaller # Required for building executable files
poetry install # Install application dependencies
- name: Compile QT resources
run: |
poetry run pyside6-rcc src/resources.qrc -o src/resources_rc.py
- name: Create AppImage for Regtest network
run: |
ARCH=$(uname -m)
VERSION=$(grep '__version__' src/version.py | cut -d "'" -f 2)
poetry run build-iris-wallet --network=regtest --distribution=appimage
REGTEST_APPIMAGE_NAME="iriswallet-${VERSION}-${ARCH}.AppImage"
RENAME_REGTEST_APPIMAGE_NAME="iriswallet-${VERSION}-regtest-${ARCH}.AppImage"
mv ${REGTEST_APPIMAGE_NAME} ${RENAME_REGTEST_APPIMAGE_NAME}
echo "RENAME_REGTEST_APPIMAGE_NAME=${RENAME_REGTEST_APPIMAGE_NAME}" >> $GITHUB_ENV
chmod +x $RENAME_REGTEST_APPIMAGE_NAME
echo "Generated file: $RENAME_REGTEST_APPIMAGE_NAME"
shell: bash
- name: Upload Regtest AppImage artifact
uses: actions/upload-artifact@v4
with:
name: linux_appimage_regtest
path: ${{ env.RENAME_REGTEST_APPIMAGE_NAME }}
- name: Create AppImage for Testnet network
run: |
ARCH=$(uname -m)
VERSION=$(grep '__version__' src/version.py | cut -d "'" -f 2)
poetry run build-iris-wallet --network=testnet --distribution=appimage
TESTNET_APPIMAGE_NAME="iriswallet-${VERSION}-${ARCH}.AppImage"
RENAME_TESTNET_APPIMAGE_NAME="iriswallet-${VERSION}-testnet-${ARCH}.AppImage"
mv ${TESTNET_APPIMAGE_NAME} ${RENAME_TESTNET_APPIMAGE_NAME}
echo "RENAME_TESTNET_APPIMAGE_NAME=${RENAME_TESTNET_APPIMAGE_NAME}" >> $GITHUB_ENV
chmod +x $RENAME_TESTNET_APPIMAGE_NAME
echo "Generated file: $RENAME_TESTNET_APPIMAGE_NAME"
shell: bash
- name: Upload Testnet AppImage artifact
uses: actions/upload-artifact@v4
with:
name: linux_appimage_testnet
path: ${{ env.RENAME_TESTNET_APPIMAGE_NAME }}
build-iris-wallet-desktop-macos:
runs-on: macos-latest
steps:
- name: Checkout code with submodules
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 1
- name: Validate Tag and Code Version
run: |
TAG_VERSION=$(git describe --tags)
echo "TAG_VERSION=${TAG_VERSION}" >> $GITHUB_ENV
# Extract version from tag
echo "Tag version: $TAG_VERSION"
# Extract version from code
CODE_VERSION=$(grep '__version__' ./src/version.py | awk -F'=' '{print $2}' | tr -d ' "' | xargs)
echo "Code version: $CODE_VERSION"
# Compare the tag and code version
if [ "$TAG_VERSION" != "$CODE_VERSION" ]; then
echo "❌ Tag version ($TAG_VERSION) does not match code version ($CODE_VERSION)."
exit 1
else
echo "✅ Tag version matches code version."
fi
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
source "$HOME/.cargo/env"
- name: Set up Python 3.12.3
uses: actions/setup-python@v5
with:
python-version: "3.12.3"
- name: Clone rgb-lightning-node repository with submodules
run: git clone https://github.com/RGB-Tools/rgb-lightning-node --recurse-submodules --shallow-submodules
- name: Build the rgb-lightning-node binary
working-directory: rgb-lightning-node
run: cargo install --locked --debug --path .
- name: Copy rgb-lightning-node binary to root directory
run: |
mkdir ln_node_binary
cp rgb-lightning-node/target/debug/rgb-lightning-node ln_node_binary
- name: Set environment variables from secrets and create config.py
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
PROJECT_ID: ${{ secrets.PROJECT_ID }}
AUTH_URI: ${{ secrets.AUTH_URI }}
TOKEN_URI: ${{ secrets.TOKEN_URI }}
AUTH_PROVIDER_CERT_URL: ${{ secrets.AUTH_PROVIDER_CERT_URL }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
run: |
cd src/utils
python generate_config.py
- name: Install python dependencies
run: |
pip install poetry
pip install pyinstaller
poetry install
- name: Compile QT resources
run: |
poetry run pyside6-rcc src/resources.qrc -o src/resources_rc.py
- name: Build the application
run: |
# Build the regtest application for macOS
poetry run build-iris-wallet --network=regtest
# Build the testnet application for macOS
poetry run build-iris-wallet --network=testnet
- name: Upload macOS artifact
uses: actions/upload-artifact@v4
with:
name: macos
path: iriswallet-*
release-artifacts:
if: needs.build-iris-wallet-desktop-macos.result == 'success' && needs.build-iris-wallet-desktop-linux.result == 'success'
runs-on: ubuntu-24.04
needs: [build-iris-wallet-desktop-macos, build-iris-wallet-desktop-linux]
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Retrieve tag name
run: |
TAG_NAME=$(git describe --tags)
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
echo "Using tag: $TAG_NAME"
- name: Prepare uploads folder
run: mkdir -p ./uploads
- name: Download macOS artifact
uses: actions/download-artifact@v4
with:
name: macos # Name of the macOS artifact
path: ./uploads # Destination path folder
- name: Download Testnet AppImage artifact
uses: actions/download-artifact@v4
with:
name: linux_appimage_testnet
path: ./uploads
- name: Download Regtest AppImage artifact
uses: actions/download-artifact@v4
with:
name: linux_appimage_regtest
path: ./uploads
- name: Extract Version and Artifacts Info
run: |
VERSION=$(grep '__version__' src/version.py | cut -d "'" -f 2)
echo "TESTNET_APPIMAGE_NAME=${TESTNET_APPIMAGE_NAME}" >> $GITHUB_ENV
echo "REGTEST_APPIMAGE_NAME=${REGTEST_APPIMAGE_NAME}" >> $GITHUB_ENV
cd uploads
REGTEST_APPNAME_MAC=$(ls iriswallet-${VERSION}-regtest-*.dmg 2>/dev/null || echo "")
TESTNET_APPNAME_MAC=$(ls iriswallet-${VERSION}-testnet-*.dmg 2>/dev/null || echo "")
TESTNET_APPIMAGE_NAME=$(ls iriswallet-${VERSION}-regtest-*.AppImage 2>/dev/null || echo "")
REGTEST_APPIMAGE_NAME=$(ls iriswallet-${VERSION}-testnet-*.AppImage 2>/dev/null || echo "")
echo "REGTEST_APPNAME_MAC=${REGTEST_APPNAME_MAC}" >> $GITHUB_ENV
echo "TESTNET_APPNAME_MAC=${TESTNET_APPNAME_MAC}" >> $GITHUB_ENV
echo "REGTEST_APPIMAGE_NAME=${REGTEST_APPIMAGE_NAME}" >> $GITHUB_ENV
echo "TESTNET_APPIMAGE_NAME=${TESTNET_APPIMAGE_NAME}" >> $GITHUB_ENV
- name: Create GitHub Release and Upload Assets
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.TAG_NAME }}
files: |
./uploads/${{ env.REGTEST_APPNAME_MAC }}
./uploads/${{ env.TESTNET_APPNAME_MAC }}
./uploads/${{ env.TESTNET_APPIMAGE_NAME }}
./uploads/${{ env.REGTEST_APPIMAGE_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
cleanup-artifacts:
if: always()
runs-on: ubuntu-22.04
needs: [build-iris-wallet-desktop-macos, build-iris-wallet-desktop-linux, release-artifacts]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Delete Artifacts from Workflow Run
uses: geekyeggo/delete-artifact@v5
with:
name: |
macos
linux_appimage_regtest
linux_appimage_testnet
failOnError: false