Skip to content

Commit 78b091b

Browse files
authored
Merge branch 'main' into dev
2 parents 66fd753 + de7c8fa commit 78b091b

File tree

1 file changed

+165
-0
lines changed

1 file changed

+165
-0
lines changed
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# Deploy a preview build with SDK integration for testing KDF API changes
2+
name: Deploy SDK Integration Preview
3+
run-name: ${{ github.actor }} is deploying SDK integration preview with API branch '${{ inputs.api_branch }}' 🚀
4+
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
api_branch:
9+
description: "API branch name to update KDF configuration"
10+
required: true
11+
default: "dev"
12+
type: string
13+
sdk_branch:
14+
description: "SDK branch to clone (optional, defaults to dev)"
15+
required: false
16+
default: "dev"
17+
type: string
18+
19+
jobs:
20+
build_and_preview:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
preview_url: ${{ steps.firebase_deploy.outputs.details_url }}
24+
channel_id: ${{ steps.get_preview_channel_id.outputs.preview_channel_id }}
25+
26+
steps:
27+
- name: Shortify commit sha
28+
shell: bash
29+
run: echo "sha_short=$(echo ${GITHUB_SHA::7})" >> $GITHUB_OUTPUT
30+
id: shortify_commit
31+
32+
- name: Get branch
33+
shell: bash
34+
run: echo "ref_short=$(echo ${GITHUB_REF##*/})" >> $GITHUB_OUTPUT
35+
id: get_branch
36+
37+
- name: Get Preview Channel ID
38+
shell: bash
39+
run: echo "preview_channel_id=sdk-integration-${{ inputs.api_branch }}-$(echo ${GITHUB_SHA::7})" >> $GITHUB_OUTPUT
40+
id: get_preview_channel_id
41+
42+
- name: Setup GH Actions
43+
uses: actions/checkout@v4
44+
45+
- name: Clone SDK repository
46+
shell: bash
47+
run: |
48+
echo "Cloning komodo-defi-sdk-flutter repository..."
49+
git clone --depth 1 --branch ${{ inputs.sdk_branch }} https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git sdk
50+
echo "SDK cloned to ./sdk directory"
51+
ls -la sdk/
52+
53+
- name: Update KDF API configuration
54+
shell: bash
55+
run: |
56+
echo "Updating KDF API configuration for branch: ${{ inputs.api_branch }}"
57+
cd sdk
58+
59+
# Check if the update script exists
60+
if [ -f "packages/komodo_wallet_cli/bin/update_api_config.dart" ]; then
61+
echo "Running update_api_config.dart script..."
62+
# Install dart dependencies first
63+
cd packages/komodo_wallet_cli
64+
dart pub get
65+
cd ../..
66+
67+
# Run the update script with the API branch
68+
dart run packages/komodo_wallet_cli/bin/update_api_config.dart ${{ inputs.api_branch }}
69+
echo "KDF API configuration updated successfully"
70+
else
71+
echo "Warning: update_api_config.dart script not found at packages/komodo_wallet_cli/bin/update_api_config.dart"
72+
echo "Available files in packages/komodo_wallet_cli/bin/:"
73+
ls -la packages/komodo_wallet_cli/bin/ || echo "Directory not found"
74+
fi
75+
76+
- name: Update pubspec.yaml to use local SDK paths
77+
shell: bash
78+
run: |
79+
echo "Updating pubspec.yaml files to use local SDK paths..."
80+
81+
# Update main pubspec.yaml
82+
echo "Updating main pubspec.yaml..."
83+
sed -i 's|komodo_cex_market_data:.*|komodo_cex_market_data:|' pubspec.yaml
84+
sed -i '/komodo_cex_market_data:/,/ref: dev/c\
85+
komodo_cex_market_data:\
86+
path: sdk/packages/komodo_cex_market_data' pubspec.yaml
87+
88+
sed -i 's|komodo_defi_sdk:.*|komodo_defi_sdk:|' pubspec.yaml
89+
sed -i '/komodo_defi_sdk:/,/ref: dev/c\
90+
komodo_defi_sdk:\
91+
path: sdk/packages/komodo_defi_sdk' pubspec.yaml
92+
93+
sed -i 's|komodo_defi_types:.*|komodo_defi_types:|' pubspec.yaml
94+
sed -i '/komodo_defi_types:/,/ref: dev/c\
95+
komodo_defi_types:\
96+
path: sdk/packages/komodo_defi_types' pubspec.yaml
97+
98+
sed -i 's|komodo_ui:.*|komodo_ui:|' pubspec.yaml
99+
sed -i '/komodo_ui:/,/ref: dev/c\
100+
komodo_ui:\
101+
path: sdk/packages/komodo_ui' pubspec.yaml
102+
103+
# Update komodo_ui_kit pubspec.yaml
104+
echo "Updating packages/komodo_ui_kit/pubspec.yaml..."
105+
sed -i 's|komodo_defi_types:.*|komodo_defi_types:|' packages/komodo_ui_kit/pubspec.yaml
106+
sed -i '/komodo_defi_types:/,/ref: dev/c\
107+
komodo_defi_types:\
108+
path: ../../sdk/packages/komodo_defi_types' packages/komodo_ui_kit/pubspec.yaml
109+
110+
sed -i 's|komodo_ui:.*|komodo_ui:|' packages/komodo_ui_kit/pubspec.yaml
111+
sed -i '/komodo_ui:/,/ref: dev/c\
112+
komodo_ui:\
113+
path: ../../sdk/packages/komodo_ui' packages/komodo_ui_kit/pubspec.yaml
114+
115+
echo "Pubspec.yaml files updated successfully"
116+
117+
# Show the changes made
118+
echo "=== Main pubspec.yaml SDK dependencies ==="
119+
grep -A2 -B1 "komodo_.*:" pubspec.yaml | grep -A2 -B1 "path: sdk"
120+
121+
echo "=== UI Kit pubspec.yaml SDK dependencies ==="
122+
grep -A2 -B1 "komodo_.*:" packages/komodo_ui_kit/pubspec.yaml | grep -A2 -B1 "path: ../../sdk"
123+
124+
- name: Install Flutter and dependencies
125+
uses: ./.github/actions/flutter-deps
126+
127+
- name: Fetch packages and generate assets
128+
uses: ./.github/actions/generate-assets
129+
with:
130+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131+
# Optionally provide feedback service configuration if available
132+
FEEDBACK_API_KEY: ${{ secrets.FEEDBACK_API_KEY }}
133+
FEEDBACK_PRODUCTION_URL: ${{ secrets.FEEDBACK_PRODUCTION_URL }}
134+
FEEDBACK_TEST_URL: ${{ secrets.FEEDBACK_TEST_URL }}
135+
TRELLO_API_KEY: ${{ secrets.TRELLO_API_KEY }}
136+
TRELLO_TOKEN: ${{ secrets.TRELLO_TOKEN }}
137+
TRELLO_BOARD_ID: ${{ secrets.TRELLO_BOARD_ID }}
138+
TRELLO_LIST_ID: ${{ secrets.TRELLO_LIST_ID }}
139+
140+
- name: Validate build
141+
uses: ./.github/actions/validate-build
142+
143+
- name: Deploy SDK Integration Preview (Expires in 7 days)
144+
id: firebase_deploy
145+
uses: FirebaseExtended/[email protected]
146+
with:
147+
repoToken: "${{ secrets.GITHUB_TOKEN }}"
148+
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_KOMODO_WALLET_OFFICIAL }}"
149+
channelId: "${{ steps.get_preview_channel_id.outputs.preview_channel_id }}"
150+
target: walletrc
151+
expires: 7d
152+
projectId: komodo-wallet-official
153+
154+
- name: Display deployment information
155+
shell: bash
156+
run: |
157+
echo "🚀 SDK Integration Preview deployed successfully!"
158+
echo "📦 SDK Branch: ${{ inputs.sdk_branch }}"
159+
echo "🔧 API Branch: ${{ inputs.api_branch }}"
160+
echo "� Channel ID: ${{ steps.get_preview_channel_id.outputs.preview_channel_id }}"
161+
echo "🌐 Preview URL: ${{ steps.firebase_deploy.outputs.details_url }}"
162+
echo "⏰ Preview expires in 7 days"
163+
echo ""
164+
echo "You can access your preview at:"
165+
echo "${{ steps.firebase_deploy.outputs.details_url }}"

0 commit comments

Comments
 (0)