Fix #242
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
workflow_call: | |
secrets: | |
KEYSTORE_FILE_BASE64: | |
KEYSTORE_KEY_ALIAS: | |
KEYSTORE_PASSWORD: | |
KEYSTORE_KEY_PASSWORD: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
windows: | |
name: windows x86_64 | |
runs-on: windows-latest | |
environment: windows | |
env: | |
build_package_name: veil-wallet win-x86_64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: 1.76.0 | |
- name: Install dependencies | |
run: | | |
git pull --recurse-submodules | |
submodules/flutter/bin/flutter config --no-analytics | |
submodules/flutter/bin/flutter config --enable-windows-desktop | |
submodules/flutter/bin/flutter pub get | |
- name: Build executable | |
run: submodules/flutter/bin/flutter build windows --release | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.build_package_name }} | |
path: build/windows/x64/runner/Release/ | |
linux: | |
name: linux x86_64 | |
runs-on: ubuntu-22.04 | |
environment: linux | |
env: | |
build_package_name: veil-wallet linux-x86_64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: 1.76.0 | |
- name: Install dependencies | |
run: | | |
git pull --recurse-submodules | |
sudo apt update -y | |
sudo apt install libsecret-1-dev clang pkg-config ninja-build libgtk-3-dev cmake | |
submodules/flutter/bin/flutter --version | |
submodules/flutter/bin/flutter config --no-analytics | |
submodules/flutter/bin/flutter config --enable-linux-desktop | |
submodules/flutter/bin/flutter pub get | |
- name: Build executable | |
run: submodules/flutter/bin/flutter build linux --release | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.build_package_name }} | |
path: 'build/linux/x64/release/bundle/' | |
macos: | |
name: macos universal | |
runs-on: macos-latest | |
environment: macos | |
env: | |
build_package_name: veil-wallet macos-universal | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: 1.76.0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'latest' | |
- name: Install dependencies | |
run: | | |
npm install -g appdmg | |
git pull --recurse-submodules | |
submodules/flutter/bin/flutter config --no-analytics | |
submodules/flutter/bin/flutter config --enable-macos-desktop | |
submodules/flutter/bin/flutter pub cache clean | |
submodules/flutter/bin/flutter pub get | |
- name: Build executable | |
run: | | |
submodules/flutter/bin/flutter clean | |
submodules/flutter/bin/flutter build macos | |
- name: Build dmg | |
run: | | |
submodules/flutter/bin/dart pub global activate flutter_distributor | |
submodules/flutter/bin/dart run flutter_distributor package --platform macos --targets dmg | |
ls ./dist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.build_package_name }} | |
path: build/macos/Build/Products/Release/veil-wallet.app | |
ios: | |
name: ios | |
runs-on: macos-latest | |
environment: ios | |
env: | |
build_package_name: veil-wallet ios | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: 1.76.0 | |
- name: Install dependencies | |
run: | | |
git pull --recurse-submodules | |
brew install ldid | |
submodules/flutter/bin/flutter config --no-analytics | |
submodules/flutter/bin/flutter pub get | |
- name: Build executable | |
run: | | |
submodules/flutter/bin/flutter build ios --release --no-codesign | |
cd ios | |
xcodebuild \ | |
-workspace Runner.xcworkspace \ | |
-scheme Runner \ | |
-sdk iphoneos \ | |
archive -archivePath Runner.xcarchive \ | |
CODE_SIGNING_REQUIRED=NO \ | |
AD_HOC_CODE_SIGNING_ALLOWED=YES \ | |
CODE_SIGNING_ALLOWED=NO \ | |
DEVELOPMENT_TEAM=XYZ0123456 \ | |
ORG_IDENTIFIER=org.veilproject | xcpretty && exit ${PIPESTATUS[0]} | |
- name: Fakesign app | |
run: | | |
cd ios | |
rm -rf Runner.xcarchive/Products/Applications/Runner.app/Frameworks/*.framework/Frameworks/ | |
ldid -SRunner/Runner.entitlements Runner.xcarchive/Products/Applications/Runner.app/Runner | |
- name: Build ipa | |
run: | | |
cd ios | |
mkdir Payload | |
mkdir Payload/Runner.app | |
cp -R Runner.xcarchive/Products/Applications/Runner.app/ Payload/Runner.app/ | |
zip -r ../app-release.ipa Payload | |
- name: Cleanup | |
run: | | |
cd ios | |
rm -fr Runner.xcarchive | |
rm -fr Payload | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.build_package_name }} | |
path: app-release.ipa | |
android: | |
name: android | |
runs-on: ubuntu-22.04 | |
container: | |
image: debian:bookworm | |
environment: android | |
env: | |
build_package_name: veil-wallet android | |
build_dir: /home/vagrant/build/org.veilproject.wallet | |
CARGO_HOME: "/home/vagrant/.cargo" | |
steps: | |
- name: Prepare image | |
run: | | |
apt update | |
apt -y install sudo | |
sudo apt install -y gcc libc-dev | |
sudo apt install -y curl | |
sudo apt install -y git | |
sudo apt install -y unzip | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '19' | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: 1.76.0 | |
targets: armv7-linux-androideabi,aarch64-linux-android,x86_64-linux-android | |
- name: Checkout | |
env: | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
GITHUB_SHA: ${{ github.sha }} | |
run: | | |
sudo mkdir -p "${{ github.workspace }}" | |
sudo mkdir -p "${{ env.build_dir }}" | |
git clone --recurse-submodules "https://github.com/$GITHUB_REPOSITORY.git" "${{ env.build_dir }}" | |
cd "${{ env.build_dir }}" | |
git checkout "$GITHUB_SHA" | |
- uses: android-actions/setup-android@v3 | |
- name: Install dependencies | |
run: | | |
ln -s /github/home/.android/sdk/cmdline-tools/11.0 /github/home/.android/sdk/cmdline-tools/latest | |
cd "${{ env.build_dir }}" | |
export PUB_CACHE=$(pwd)/.pub-cache | |
submodules/flutter/bin/flutter config --no-analytics | |
submodules/flutter/bin/flutter pub get | |
- name: Check signing key | |
id: key-check | |
env: | |
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_FILE_BASE64 }} | |
shell: bash | |
run: | | |
cd "${{ env.build_dir }}" | |
if [ "$KEYSTORE_BASE64" != '' ]; then | |
echo "available=true" >> $GITHUB_OUTPUT; | |
else | |
echo "available=false" >> $GITHUB_OUTPUT; | |
fi | |
- name: Retrieve base64 keystore and decode it to a file | |
if: ${{ steps.key-check.outputs.available == 'true' }} | |
env: | |
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_FILE_BASE64 }} | |
run: echo $KEYSTORE_BASE64 | base64 --decode > '${{ github.workspace }}/android-keystore.jks' | |
- name: Create keystore.properties file | |
if: ${{ steps.key-check.outputs.available == 'true' }} | |
env: | |
KEYSTORE_PROPERTIES_PATH: ${{ env.build_dir }}/android/key.properties | |
run: | | |
echo 'storeFile=${{ github.workspace }}/android-keystore.jks' > $KEYSTORE_PROPERTIES_PATH | |
echo 'keyAlias=${{ secrets.KEYSTORE_KEY_ALIAS }}' >> $KEYSTORE_PROPERTIES_PATH | |
echo 'storePassword=${{ secrets.KEYSTORE_PASSWORD }}' >> $KEYSTORE_PROPERTIES_PATH | |
echo 'keyPassword=${{ secrets.KEYSTORE_KEY_PASSWORD }}' >> $KEYSTORE_PROPERTIES_PATH | |
- name: Build executable | |
if: ${{ steps.key-check.outputs.available == 'true' }} | |
run: | | |
cd "${{ env.build_dir }}" | |
flutter_vercode=$(grep -Po 'version:\s.+\+(\d+)|.|version:\s(.+)\+' pubspec.yaml | grep -Po '(?<=\+)\d+' | awk '{print $1}') | |
submodules/flutter/bin/flutter build apk --release --no-tree-shake-icons | |
abiver=$(($flutter_vercode * 10 + 1)) | |
submodules/flutter/bin/flutter build apk --release --no-tree-shake-icons --split-per-abi --target-platform="android-arm" --build-number=$abiver | |
abiver=$(($flutter_vercode * 10 + 2)) | |
submodules/flutter/bin/flutter build apk --release --no-tree-shake-icons --split-per-abi --target-platform="android-arm64" --build-number=$abiver | |
abiver=$(($flutter_vercode * 10 + 3)) | |
submodules/flutter/bin/flutter build apk --release --no-tree-shake-icons --split-per-abi --target-platform="android-x64" --build-number=$abiver | |
- name: Build executable (debug) | |
if: ${{ steps.key-check.outputs.available != 'true' }} | |
run: | | |
cd "${{ env.build_dir }}" | |
flutter_vercode=$(grep -Po 'version:\s.+\+(\d+)|.|version:\s(.+)\+' pubspec.yaml | grep -Po '(?<=\+)\d+' | awk '{print $1}') | |
submodules/flutter/bin/flutter build apk --debug --no-tree-shake-icons | |
abiver=$(($flutter_vercode * 10 + 1)) | |
submodules/flutter/bin/flutter build apk --debug --no-tree-shake-icons --split-per-abi --target-platform="android-arm" --build-number=$abiver | |
abiver=$(($flutter_vercode * 10 + 2)) | |
submodules/flutter/bin/flutter build apk --debug --no-tree-shake-icons --split-per-abi --target-platform="android-arm64" --build-number=$abiver | |
abiver=$(($flutter_vercode * 10 + 3)) | |
submodules/flutter/bin/flutter build apk --debug --no-tree-shake-icons --split-per-abi --target-platform="android-x64" --build-number=$abiver | |
- name: Cleanup | |
if: always() | |
run: rm ${{ env.build_dir }}/android/key.properties | |
- uses: actions/upload-artifact@v4 | |
if: ${{ steps.key-check.outputs.available == 'true' }} | |
with: | |
name: ${{ env.build_package_name }} | |
path: ${{ env.build_dir }}/build/app/outputs/flutter-apk/app-release.apk | |
- uses: actions/upload-artifact@v4 | |
if: ${{ steps.key-check.outputs.available == 'true' }} | |
with: | |
name: ${{ env.build_package_name }}-armeabi-v7a | |
path: ${{ env.build_dir }}/build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk | |
- uses: actions/upload-artifact@v4 | |
if: ${{ steps.key-check.outputs.available == 'true' }} | |
with: | |
name: ${{ env.build_package_name }}-arm64-v8a | |
path: ${{ env.build_dir }}/build/app/outputs/flutter-apk/app-arm64-v8a-release.apk | |
- uses: actions/upload-artifact@v4 | |
if: ${{ steps.key-check.outputs.available == 'true' }} | |
with: | |
name: ${{ env.build_package_name }}-x86_64 | |
path: ${{ env.build_dir }}/build/app/outputs/flutter-apk/app-x86_64-release.apk | |
- uses: actions/upload-artifact@v4 | |
if: ${{ steps.key-check.outputs.available != 'true' }} | |
with: | |
name: ${{ env.build_package_name }} | |
path: ${{ env.build_dir }}/build/app/outputs/flutter-apk/app-debug.apk | |
- uses: actions/upload-artifact@v4 | |
if: ${{ steps.key-check.outputs.available != 'true' }} | |
with: | |
name: ${{ env.build_package_name }}-armeabi-v7a | |
path: ${{ env.build_dir }}/build/app/outputs/flutter-apk/app-armeabi-v7a-debug.apk | |
- uses: actions/upload-artifact@v4 | |
if: ${{ steps.key-check.outputs.available != 'true' }} | |
with: | |
name: ${{ env.build_package_name }}-arm64-v8a | |
path: ${{ env.build_dir }}/build/app/outputs/flutter-apk/app-arm64-v8a-debug.apk | |
- uses: actions/upload-artifact@v4 | |
if: ${{ steps.key-check.outputs.available != 'true' }} | |
with: | |
name: ${{ env.build_package_name }}-x86_64 | |
path: ${{ env.build_dir }}/build/app/outputs/flutter-apk/app-x86_64-debug.apk |