-
Notifications
You must be signed in to change notification settings - Fork 379
126 lines (108 loc) · 3.8 KB
/
distribute_external.yml
File metadata and controls
126 lines (108 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: distribute_external
on:
release:
types: [published]
workflow_dispatch:
inputs:
platform:
description: 'Platform to build (android, ios, or both)'
required: true
default: 'both'
type: choice
options:
- android
- ios
- both
env:
FLUTTER_VERSION: '3.x'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
determine_platforms:
runs-on: ubuntu-latest
outputs:
run_ios: ${{ steps.set_matrix.outputs.run_ios }}
run_android: ${{ steps.set_matrix.outputs.run_android }}
steps:
- name: Determine platforms to build
id: set_matrix
run: |
# Is this a release?
is_release="${{ github.event_name == 'release' }}"
# If it's a release event, build both platforms
if [[ "$is_release" == "true" ]]; then
echo "Building all platforms due to release"
echo "run_ios=true" >> $GITHUB_OUTPUT
echo "run_android=true" >> $GITHUB_OUTPUT
exit 0
fi
# For manual workflow dispatch, store platform in a variable
platform="${{ github.event.inputs.platform }}"
echo "Selected platform: $platform"
# Set outputs only if they should be true
[[ "$platform" == "ios" || "$platform" == "both" ]] && echo "run_ios=true" >> $GITHUB_OUTPUT
[[ "$platform" == "android" || "$platform" == "both" ]] && echo "run_android=true" >> $GITHUB_OUTPUT
android:
needs: determine_platforms
if: ${{ needs.determine_platforms.outputs.run_android == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Connect Bot
uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.BOT_SSH_PRIVATE_KEY }}
- name: "Git Checkout"
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: "Install Flutter"
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
working-directory: sample_app/android
- name: Distribute to S3
working-directory: sample_app/android
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
run: bundle exec fastlane distribute_to_s3
ios:
needs: determine_platforms
if: ${{ needs.determine_platforms.outputs.run_ios == 'true' }}
runs-on: macos-15 # Requires xcode 15 or later
steps:
- name: Connect Bot
uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.BOT_SSH_PRIVATE_KEY }}
- name: "Git Checkout"
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: "Install Flutter"
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
working-directory: sample_app/ios
- name: Distribute to TestFlight
working-directory: sample_app/ios
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
APPSTORE_API_KEY: ${{ secrets.APPSTORE_API_KEY }}
run: bundle exec fastlane distribute_to_testflight