Skip to content

cmd -> pwsh

cmd -> pwsh #19

name: Cake Wallet Windows
on: [push]
defaults:
run:
shell: powershell
jobs:
PR_test_build_windows:
runs-on: windows-amd64-cake
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- uses: actions/checkout@v4
- name: Add secrets
run: |
New-Item -ItemType File -Force lib\.secrets.g.dart
New-Item -ItemType File -Force cw_evm\lib\.secrets.g.dart
New-Item -ItemType File -Force cw_solana\lib\.secrets.g.dart
New-Item -ItemType File -Force cw_core\lib\.secrets.g.dart
New-Item -ItemType File -Force cw_nano\lib\.secrets.g.dart
New-Item -ItemType File -Force cw_tron\lib\.secrets.g.dart
if ('${{ secrets.SALT }}' -eq '') { Add-Content lib\.secrets.g.dart 'const salt = "954f787f12622067f7e548d9450c3832";' } else { Add-Content lib\.secrets.g.dart "const salt = '${{ secrets.SALT }}';" }
if ('${{ secrets.KEY_CHAIN_SALT }}' -eq '') { Add-Content lib\.secrets.g.dart 'const keychainSalt = "2d2beba777dbf7dff7013b7a";' } else { Add-Content lib\.secrets.g.dart "const keychainSalt = '${{ secrets.KEY_CHAIN_SALT }}';" }
if ('${{ secrets.KEY }}' -eq '') { Add-Content lib\.secrets.g.dart 'const key = "638e98820ec10a2945e968435c9397a3";' } else { Add-Content lib\.secrets.g.dart "const key = '${{ secrets.KEY }}';" }
if ('${{ secrets.WALLET_SALT }}' -eq '') { Add-Content lib\.secrets.g.dart 'const walletSalt = "8f7f1b70";' } else { Add-Content lib\.secrets.g.dart "const walletSalt = '${{ secrets.WALLET_SALT }}';" }
if ('${{ secrets.SHORT_KEY }}' -eq '') { Add-Content lib\.secrets.g.dart 'const shortKey = "653f270c2c152bc7ec864afe";' } else { Add-Content lib\.secrets.g.dart "const shortKey = '${{ secrets.SHORT_KEY }}';" }
if ('${{ secrets.BACKUP_SALT }}' -eq '') { Add-Content lib\.secrets.g.dart 'const backupSalt = "bf630d24ff0b6f60";' } else { Add-Content lib\.secrets.g.dart "const backupSalt = '${{ secrets.BACKUP_SALT }}';" }
if ('${{ secrets.BACKUP_KEY_CHAIN_SALT }}' -eq '') { Add-Content lib\.secrets.g.dart 'const backupKeychainSalt = "bf630d24ff0b6f60";' } else { Add-Content lib\.secrets.g.dart "const backupKeychainSalt = '${{ secrets.BACKUP_KEY_CHAIN_SALT }}';" }
# Add remaining secrets
Add-Content lib\.secrets.g.dart "const changeNowApiKey = '${{ secrets.CHANGE_NOW_API_KEY }}';"
Add-Content lib\.secrets.g.dart "const changeNowApiKeyDesktop = '${{ secrets.CHANGE_NOW_API_KEY_DESKTOP }}';"
Add-Content lib\.secrets.g.dart "const wyreSecretKey = '${{ secrets.WYRE_SECRET_KEY }}';"
Add-Content lib\.secrets.g.dart "const wyreApiKey = '${{ secrets.WYRE_API_KEY }}';"
Add-Content lib\.secrets.g.dart "const wyreAccountId = '${{ secrets.WYRE_ACCOUNT_ID }}';"
Add-Content lib\.secrets.g.dart "const moonPayApiKey = '${{ secrets.MOON_PAY_API_KEY }}';"
Add-Content lib\.secrets.g.dart "const moonPaySecretKey = '${{ secrets.MOON_PAY_SECRET_KEY }}';"
Add-Content lib\.secrets.g.dart "const sideShiftAffiliateId = '${{ secrets.SIDE_SHIFT_AFFILIATE_ID }}';"
Add-Content lib\.secrets.g.dart "const simpleSwapApiKey = '${{ secrets.SIMPLE_SWAP_API_KEY }}';"
Add-Content lib\.secrets.g.dart "const simpleSwapApiKeyDesktop = '${{ secrets.SIMPLE_SWAP_API_KEY_DESKTOP }}';"
Add-Content lib\.secrets.g.dart "const onramperApiKey = '${{ secrets.ONRAMPER_API_KEY }}';"
Add-Content lib\.secrets.g.dart "const anypayToken = '${{ secrets.ANY_PAY_TOKEN }}';"
Add-Content lib\.secrets.g.dart "const ioniaClientId = '${{ secrets.IONIA_CLIENT_ID }}';"
Add-Content lib\.secrets.g.dart "const twitterBearerToken = '${{ secrets.TWITTER_BEARER_TOKEN }}';"
Add-Content lib\.secrets.g.dart "const trocadorApiKey = '${{ secrets.TROCADOR_API_KEY }}';"
Add-Content lib\.secrets.g.dart "const trocadorExchangeMarkup = '${{ secrets.TROCADOR_EXCHANGE_MARKUP }}';"
Add-Content lib\.secrets.g.dart "const anonPayReferralCode = '${{ secrets.ANON_PAY_REFERRAL_CODE }}';"
Add-Content lib\.secrets.g.dart "const fiatApiKey = '${{ secrets.FIAT_API_KEY }}';"
Add-Content lib\.secrets.g.dart "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';"
Add-Content lib\.secrets.g.dart "const chainStackApiKey = '${{ secrets.CHAIN_STACK_API_KEY }}';"
Add-Content lib\.secrets.g.dart "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';"
Add-Content cw_evm\lib\.secrets.g.dart "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';"
Add-Content cw_evm\lib\.secrets.g.dart "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';"
Add-Content cw_evm\lib\.secrets.g.dart "const nowNodesApiKey = '${{ secrets.EVM_NOWNODES_API_KEY }}';"
Add-Content cw_solana\lib\.secrets.g.dart "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';"
Add-Content cw_solana\lib\.secrets.g.dart "const chainStackApiKey = '${{ secrets.CHAIN_STACK_API_KEY }}';"
Add-Content lib\.secrets.g.dart "const testCakePayApiKey = '${{ secrets.TEST_CAKE_PAY_API_KEY }}';"
Add-Content lib\.secrets.g.dart "const cakePayApiKey = '${{ secrets.CAKE_PAY_API_KEY }}';"
Add-Content lib\.secrets.g.dart "const authorization = '${{ secrets.CAKE_PAY_AUTHORIZATION }}';"
Add-Content lib\.secrets.g.dart "const CSRFToken = '${{ secrets.CSRF_TOKEN }}';"
Add-Content lib\.secrets.g.dart "const quantexExchangeMarkup = '${{ secrets.QUANTEX_EXCHANGE_MARKUP }}';"
Add-Content cw_nano\lib\.secrets.g.dart "const nano2ApiKey = '${{ secrets.NANO2_API_KEY }}';"
Add-Content cw_nano\lib\.secrets.g.dart "const nanoNowNodesApiKey = '${{ secrets.NANO_NOW_NODES_API_KEY }}';"
Add-Content cw_tron\lib\.secrets.g.dart "const tronGridApiKey = '${{ secrets.TRON_GRID_API_KEY }}';"
Add-Content cw_tron\lib\.secrets.g.dart "const tronNowNodesApiKey = '${{ secrets.TRON_NOW_NODES_API_KEY }}';"
Add-Content lib\.secrets.g.dart "const meldTestApiKey = '${{ secrets.MELD_TEST_API_KEY }}';"
Add-Content lib\.secrets.g.dart "const meldTestPublicKey = '${{ secrets.MELD_TEST_PUBLIC_KEY }}';"
Add-Content lib\.secrets.g.dart "const letsExchangeBearerToken = '${{ secrets.LETS_EXCHANGE_TOKEN }}';"
Add-Content lib\.secrets.g.dart "const letsExchangeAffiliateId = '${{ secrets.LETS_EXCHANGE_AFFILIATE_ID }}';"
Add-Content lib\.secrets.g.dart "const stealthExBearerToken = '${{ secrets.STEALTH_EX_BEARER_TOKEN }}';"
Add-Content lib\.secrets.g.dart "const stealthExAdditionalFeePercent = '${{ secrets.STEALTH_EX_ADDITIONAL_FEE_PERCENT }}';"
- name: Execute Build and Setup Commands
run: |
# Execute Build and Setup Commands
Write-Host "Run manifest.sh without the need for bash"
Copy-Item -Path "./android/app/src/main/AndroidManifestBase.xml" -Destination "./android/app/src/main/AndroidManifest.xml"
Copy-Item -Path "pubspec_description.yaml" -Destination "pubspec.yaml"
flutter pub get
dart run tool\generate_pubspec.dart
flutter pub get
dart run tool\configure.dart --monero --bitcoin --ethereum --polygon --nano --bitcoinCash --solana --tron
Write-Host "=== Generating mobx models ==="
Set-Location -Path "cw_core"
flutter pub get
dart run build_runner build --delete-conflicting-outputs
Set-Location -Path ..
Set-Location -Path "cw_monero"
flutter pub get
dart run build_runner build --delete-conflicting-outputs
Set-Location -Path ..
Set-Location -Path "cw_bitcoin"
flutter pub get
dart run build_runner build --delete-conflicting-outputs
Set-Location -Path ..
Set-Location -Path "cw_ethereum"
flutter pub get
dart run build_runner build --delete-conflicting-outputs
Set-Location -Path ..
Set-Location -Path "cw_evm"
flutter pub get
dart run build_runner build --delete-conflicting-outputs
Set-Location -Path ..
Set-Location -Path "cw_polygon"
flutter pub get
dart run build_runner build --delete-conflicting-outputs
Set-Location -Path ..
Set-Location -Path "cw_nano"
flutter pub get
dart run build_runner build --delete-conflicting-outputs
Set-Location -Path ..
Set-Location -Path "cw_bitcoin_cash"
flutter pub get
dart run build_runner build --delete-conflicting-outputs
Set-Location -Path ..
Set-Location -Path "cw_solana"
flutter pub get
dart run build_runner build --delete-conflicting-outputs
Set-Location -Path ..
Set-Location -Path "cw_tron"
flutter pub get
dart run build_runner build --delete-conflicting-outputs
Set-Location -Path ..
Write-Host "=== Generating localization files ==="
dart run tool\generate_localization.dart
- name: download monero_c prebuilds (can't build inside of windows container)
run: |
cp pubspec_base.yaml pubspec.yaml
flutter pub get
dart run tool/download_moneroc_prebuilds.dart
- name: Build
run: |
echo === Building the application executable file ===
call flutter build windows --release
# - name: Upload Artifact
# uses: actions/upload-artifact@v4
# with:
# path: ${{ github.workspace }}/build/app/outputs/flutter-apk/test-apk/