Skip to content

Commit

Permalink
feat: release regtest ios app on push to main
Browse files Browse the repository at this point in the history
  • Loading branch information
bonomat committed Aug 8, 2023
1 parent 6ab3247 commit 4834b0f
Show file tree
Hide file tree
Showing 22 changed files with 1,070 additions and 91 deletions.
17 changes: 17 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,20 @@ ESPLORA_ENDPOINT=http://35.189.57.114:3000
COORDINATOR_P2P_ENDPOINT=03507b924dae6595cfb78492489978127c5f1e3877848564de2015cd6d41375802@35.189.57.114:9045
COORDINATOR_PORT_HTTP=80
NETWORK=regtest
# Fastlane variables
FASTLANE_DEVELOPER_APP_ID="1234567890"
#FASTLANE_DEVELOPER_APP_IDENTIFIER="finance.get10101.app.test"
FASTLANE_DEVELOPER_APP_IDENTIFIER="finance.get10101.app"
#FASTLANE_PROVISIONING_PROFILE_SPECIFIER="match AppStore finance.get10101.app.test"
FASTLANE_PROVISIONING_PROFILE_SPECIFIER="match AppStore finance.get10101.app"
#FASTLANE_APP_SCHEME="Runner"
FASTLANE_APP_SCHEME="test" # or "Runner"
FASTLANE_APPLE_ID="[email protected]"
FASTLANE_TEMP_KEYCHAIN_USER="[email protected]"
FASTLANE_TEMP_KEYCHAIN_PASSWORD="some-random-password"
FASTLANE_APPLE_ISSUER_ID="12234124-1111-2222-3333-444444444444"
FASTLANE_APPLE_KEY_ID="123456678"
FASTLANE_APPLE_KEY_CONTENT="-----BEGIN PRIVATE KEY-----\....\n-----END PRIVATE KEY-----"
FASTLANE_GIT_AUTHORIZATION="username:github_token"
FASTLANE_APP_STORE_CONNECT_TEAM_ID=123456789
FASTLANE_DEVELOPER_PORTAL_TEAM_ID=1234567890
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
push:
branches:
- "staging"
- "main"
# - "main"

env:
CARGO_INCREMENTAL: 0
Expand Down
25 changes: 14 additions & 11 deletions .github/workflows/deliverables-push-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ on:
- main

jobs:
build_docker_image_for_latest_main:
permissions:
packages: write
contents: read
uses: ./.github/workflows/docker.yml
with:
tag: main
# build_docker_image_for_latest_main:
# permissions:
# packages: write
# contents: read
# uses: ./.github/workflows/docker.yml
# with:
# tag: main

# job to run change detection
changes:
Expand All @@ -33,19 +33,22 @@ jobs:
- 'mobile/**'
- 'Cargo.*'
build_and_release_ios_app_for_latest_main:
build_and_release_regtest_ios_app_for_latest_main:
needs: changes
if: needs.changes.outputs.ios-app == 'true' && contains(github.event.head_commit.message, 'release') == 'false' && contains(github.event.head_commit.message, 'Merge') == 'false'
# if: needs.changes.outputs.ios-app == 'true'
permissions:
packages: write
contents: read
uses: ./.github/workflows/ios.yml
uses: ./.github/workflows/ios-fastlane.yml
secrets: inherit
with:
esplora_endpoint: https://blockstream.info/api
esplora_endpoint: http://35.189.57.114:3000
coordinator_p2p_endpoint: 03507b924dae6595cfb78492489978127c5f1e3877848564de2015cd6d41375802@35.189.57.114:9045
coordinator_port_http: 80
network: regtest
tag: main
oracle_endpoint: http://api.test.10101.finance:8081
oracle_pubkey: 5d12d79f575b8d99523797c46441c0549eb0defb6195fe8a080000cbe3ab3859
fastlane_developer_app_identifier: finance.get10101.app.test
fastlane_provisioning_profile_specifier: match AppStore finance.get10101.app.test
app_scheme: regtest
163 changes: 163 additions & 0 deletions .github/workflows/ios-fastlane.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
name: "Build and release ios app to TestFlight"

on:
workflow_call:
inputs:
coordinator_port_http:
required: true
type: string
esplora_endpoint:
required: true
type: string
coordinator_p2p_endpoint:
required: true
type: string
network:
required: true
type: string
description: "The target network for the release, e.g. mainnet/regtest"
tag:
required: true
description: "The branch, tag or SHA to checkout."
type: string
oracle_endpoint:
required: true
type: string
oracle_pubkey:
required: true
description: "The public key of the oracle. Must match with the public key returned at http://${oracle_endpoint}/oracle/publickey"
type: string
app_scheme:
required: true
description: "For regtest enter 'regtest' or mainnet enter 'Runner'"
type: string
fastlane_provisioning_profile_specifier:
required: true
description: "For regtest enter 'match AppStore finance.get10101.app.test' or mainnet enter 'match AppStore finance.get10101.app 1691412333'"
type: string
fastlane_developer_app_identifier:
required: true
description: "For regtest enter 'finance.get10101.app.test' or mainnet enter 'finance.get10101.app'"
type: string
workflow_dispatch:
inputs:
coordinator_port_http:
required: true
type: string
esplora_endpoint:
required: true
type: string
coordinator_p2p_endpoint:
required: true
type: string
network:
required: true
type: string
description: "The target network for the release, e.g. mainnet/regtest"
tag:
required: true
description: "The branch, tag or SHA to checkout."
type: string
oracle_endpoint:
required: true
type: string
oracle_pubkey:
required: true
description: "The public key of the oracle. Must match with the public key returned at http://${oracle_endpoint}/oracle/publickey"
type: string

jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
# fetch the complete history to correctly calculate build_number
fetch-depth: 0
ref: ${{ inputs.tag }}

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "14.2"

- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }}
architecture: x64

- uses: actions/cache@v3
id: cache-deps
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./rust/target
key: ${{ runner.os }}-cargo-build-release-ios-${{ hashFiles('**/Cargo.lock') }}

- name: Install just
if: steps.cache-deps.outputs.cache-hit != 'true'
run: cargo install just

- name: Install fastlane
run: |
cd mobile/ios/fastlane
gem install bundler
- name: Install FFI bindings
if: steps.cache-deps.outputs.cache-hit != 'true'
run: just deps-gen

- name: Install ios dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: cargo install cargo-lipo

- name: Set rustup targets
run: rustup target add aarch64-apple-ios x86_64-apple-ios

- name: Generate FFI bindings
run: just gen

- name: Build iOS Rust lib in release mode
run: just ios-release

- name: Parse version from pubspec.yaml
id: version
uses: jbutcher5/[email protected]
with:
file: "mobile/pubspec.yaml"
key-path: '["version"]'

- name: Build iOS Archive
id: build-ios
run: |
NETWORK=$NETWORK just build-ipa-no-codesign
env:
ESPLORA_ENDPOINT: ${{ inputs.esplora_endpoint }}
COORDINATOR_P2P_ENDPOINT: ${{ inputs.coordinator_p2p_endpoint }}
NETWORK: ${{ inputs.network }}
COORDINATOR_PORT_HTTP: ${{ inputs.coordinator_port_http }}
ORACLE_ENDPOINT: ${{ inputs.oracle_endpoint }}
ORACLE_PUBKEY: ${{ inputs.oracle_pubkey }}

- name: Release to TestFlight
env:
# secrets
FASTLANE_APPLE_ID: ${{ secrets.FASTLANE_APPLE_ID }}
FASTLANE_APP_STORE_CONNECT_TEAM_ID: ${{ secrets.FASTLANE_APP_STORE_CONNECT_TEAM_ID }}
FASTLANE_DEVELOPER_PORTAL_TEAM_ID: ${{ secrets.FASTLANE_DEVELOPER_PORTAL_TEAM_ID }}
FASTLANE_DEVELOPER_APP_ID: ${{ secrets.FASTLANE_DEVELOPER_APP_ID }}
FASTLANE_TEMP_KEYCHAIN_USER: ${{ secrets.FASTLANE_TEMP_KEYCHAIN_USER }}
FASTLANE_TEMP_KEYCHAIN_PASSWORD: ${{ secrets.FASTLANE_TEMP_KEYCHAIN_PASSWORD }}
FASTLANE_APPLE_ISSUER_ID: ${{ secrets.FASTLANE_APPLE_ISSUER_ID }}
FASTLANE_APPLE_KEY_ID: ${{ secrets.FASTLANE_APPLE_KEY_ID }}
FASTLANE_APPLE_KEY_CONTENT: ${{ secrets.FASTLANE_APPLE_KEY_CONTENT }}
FASTLANE_GIT_AUTHORIZATION: ${{ secrets.FASTLANE_GIT_AUTHORIZATION }}
# inputs
FASTLANE_DEVELOPER_APP_IDENTIFIER: ${{ inputs.fastlane_developer_app_identifier }}
FASTLANE_PROVISIONING_PROFILE_SPECIFIER: ${{ inputs.fastlane_provisioning_profile_specifier }}
FASTLANE_APP_SCHEME: ${{ inputs.app_scheme }}
run: |
just publish-testflight-fastlane
Loading

0 comments on commit 4834b0f

Please sign in to comment.