Skip to content

[deployment] using github actions android build #175

[deployment] using github actions android build

[deployment] using github actions android build #175

Workflow file for this run

on: [push, pull_request]
# this from from https://github.com/sunshine-protocol/sunscreen Appache 2.0 license
#
# name is (urlencode) connected to README.md svg badge (change it there as well)
name: iOS Build
jobs:
build:
name: Compile and Build - iOS
runs-on: macos-latest
steps:
# use to your like https://github.com/marketplace?type=actions
# #################### build conditions
- name: vtag variable
shell: bash
run: echo "vtag=$(echo ${GITHUB_REF#refs/tags/} | awk '/v([0-9]+\.)+[0-9]+/{print $0}')" >> $GITHUB_ENV
- name: Extractor for vtag env
id: extract_tag
shell: bash
run: echo "{tag}==${{ env.vtag }}" >> $GITHUB_OUTPUT
- name: Release
if: steps.extract_tag.outputs.tag != null
shell: bash
run: echo "Building release"
# ##################### setup build environment
- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v2
with:
path: ${{ runner.temp }}/llvm/11.0
key: ${{ runner.os }}-cached-llvm-11.0
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "11.0"
directory: ${{ runner.temp }}/llvm/11.0
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
- name: Checkout sources
uses: actions/checkout@v2
- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- name: Install WASM Target
run: rustup target add wasm32-unknown-unknown
- name: Cache Cargo
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
target/aarch64-apple-ios
target/x86_64-apple-ios
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# todo: some time again, test https://github.com/actions-rs/install
- name: Install Cargo Tools (cargo-make, v0.32)
uses: actions-rs/cargo@v1
continue-on-error: true
with:
command: install
args: cargo-make --version ^0.32
- name: Install Cargo Tools (cbindgen, v0.15)
uses: actions-rs/cargo@v1
continue-on-error: true
with:
command: install
args: cbindgen --version ^0.15
- name: Install Cargo Tools (dart-bindgen, v0.1)
uses: actions-rs/cargo@v1
continue-on-error: true
with:
command: install
args: dart-bindgen --features cli --version ^0.1
- name: Setup Flutter
uses: subosito/flutter-action@v1
with:
channel: "stable"
- name: Run Flutter pub get
run: flutter pub get
- name: Install iOS Targets
run: rustup target add aarch64-apple-ios x86_64-apple-ios
# ############### Release/Debug build dependent
- name: Run cargo make ios - Release
if: steps.extract_tag.outputs.tag != null
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: make
args: ios --profile release
- name: Run cargo make ios - Debug
if: steps.extract_tag.outputs.tag == null
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: make
args: ios --profile debug
- name: Build iOS App - release
if: steps.extract_tag.outputs.tag != null
# todo: no release build for now - no key from apple yet
# run: flutter build ios --release --no-codesign
run: flutter build ios --debug --no-codesign --simulator --obfuscate --split-debug-info=build/dart-debug-info/${{ steps.extract_tag.outputs.tag }}/ios
- name: Build iOS App - debug
if: steps.extract_tag.outputs.tag == null
run: flutter build ios --debug --no-sound-null-safety --no-codesign --simulator
# ####################### upload intermediate result dependent if release in text or tagged
# https://github.com/marketplace/actions/upload-files-to-a-github-release
- name: Upload Release Asset
if: steps.extract_tag.outputs.tag != null
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
#file: ./build/ios/iphoneos/Runner.app
file: ./build/ios/iphonesimulator/Runner.app
asset_name: adbfflutter-ios-intermediate-simulator-${{ steps.extract_tag.outputs.tag }}.app
tag: ${{ steps.extract_tag.outputs.tag }}
overwrite: true