Skip to content

Commit a45e82a

Browse files
author
impri2
committed
chore: auto upload to testflight
1 parent 3495dea commit a45e82a

3 files changed

Lines changed: 109 additions & 2 deletions

File tree

.github/cd.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Siksha-CD
2+
3+
on:
4+
push:
5+
tags:
6+
- testflight/v[0-9]+.[0-9]+.[0-9]+-*.[0-9]+
7+
- appstore/v[0-9]+.[0-9]+.[0-9]+-*.[0-9]+
8+
9+
jobs:
10+
deploy:
11+
name: Execute fastlane for testflight / appstore
12+
13+
env:
14+
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
15+
SSH_KEY: ${{ secrets.SSH_KEY }}
16+
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
17+
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
18+
APP_STORE_CONNECT_KEY_CONTENT: ${{ secrets.APP_STORE_CONNECT_KEY_CONTENT }}
19+
SLACK_URL: ${{ secrets.SLACK_WEBHOOK }}
20+
GIT_TAG_NAME: ${{ github.ref_name }}
21+
XCODE_VERSION: "16.2"
22+
23+
runs-on: macos-15
24+
25+
steps:
26+
- name: Parse tag name
27+
uses: actions-ecosystem/action-regex-match@v2
28+
id: regex
29+
with:
30+
text: ${{ github.ref_name }}
31+
regex: '^(testflight|appstore)\/v(\d+)\.(\d+)\.(\d+)-(release|debug)\.(\d+)$'
32+
33+
- if: ${{ steps.regex.outputs.group1 == 'appstore' && steps.regex.outputs.group5 == 'debug' }}
34+
run: |
35+
echo "you can't upload debug build to appstore!"
36+
exit 1
37+
38+
- uses: actions/checkout@v3
39+
40+
- run: |
41+
sudo xcode-select -s /Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer
42+
ls
43+
44+
- name: Set version number and build number
45+
run: |
46+
echo "VERSION_NUMBER=${{ steps.regex.outputs.group2 }}.${{ steps.regex.outputs.group3 }}.${{ steps.regex.outputs.group4 }}" >> $GITHUB_ENV
47+
echo "BUILD_NUMBER=${{ steps.regex.outputs.group6 }}" >> $GITHUB_ENV
48+
49+
- name: Install Ruby Dependencies
50+
run: |
51+
bundle install
52+
bundle update fastlane
53+
54+
- name: Setup match repo ssh
55+
uses: shimataro/ssh-key-action@v2
56+
with:
57+
key: ${{ secrets.SSH_KEY }}
58+
known_hosts: ${{ secrets.KNOWN_HOSTS }}
59+
60+
61+
62+
- name: Inject secret file dependencies
63+
env:
64+
BUNDLE: ${{ secrets.BUNDLE }}
65+
BUNDLE_DEV: ${{secrets.BUNDLE_DEV}}
66+
CONFIG: ${{ secrets.CONFIG }}
67+
GOOGLE_SERVICE_INFO: ${{ secrets.GOOGLE_SERVICE_INFO }}
68+
GOOGLE_SERVICE_INFO_DEV: ${{ secrets.GOOGLE_SERVICE_INFO_DEV }}
69+
run: |
70+
echo "$BUNDLE" > Siksha/Supporting Files/bundle.xcconfig
71+
echo "$BUNDLE_DEV" > Siksha/Supporting Files/bundle-dev.xcconfig
72+
echo "$CONFIG" > Siksha/Supporting Files/config.plist
73+
echo "$GOOGLE_SERVICE_INFO" > Siksha/Supporting Files/GoogleService-Info.plist
74+
echo "$GOOGLE_SERVICE_INFO_DEV" > Siksha/Supporting Files/GoogleService-Info-dev.xcconfig
75+
76+
77+
- name: Upload prod app to TestFlight
78+
if: ${{ steps.regex.outputs.group1 == 'testflight' && steps.regex.outputs.group5 == 'release' }}
79+
run: |
80+
bundle exec fastlane beta --env prod
81+

fastlane/Fastfile

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,28 @@
1616
default_platform(:ios)
1717

1818
platform :ios do
19-
desc "Description of what the lane does"
20-
lane :custom_lane do
19+
desc "Upload app to testflight"
20+
lane :beta do
21+
setup_ci
22+
match(
23+
git_url:"https://github.com/wafflestudio/siksha-ios-private",
24+
storage_mode: "git",
25+
type: "appstore",
26+
readonly: true
27+
)
28+
app_store_connect_api_key(
29+
key_id:ENV["APPSTORE_CONNECT_KEY_ID"],
30+
issuer_id:ENV["APPSTORE_CONNECT_ISSUER_ID"],
31+
key_content:ENV["APPSTORE_CONNECT_KEY_CONTENT"]
32+
)
33+
34+
increment_build_number(build_number:ENV["BUILD_NUMBER"],xcodeproj:"Siksha.xcodeproj")
35+
increment_version_number(version_number:ENV["VERSION_NUMBER"],xcodeproj:"Siksha.xcodeproj")
36+
upload_to_testflight(app_version:ENV["VERSION_NUMBER"])
37+
slack(message:"uploaded to testflight")
2138
# add actions here: https://docs.fastlane.tools/actions
2239
end
40+
2341
end
2442

2543
lane :register_new_devices do

fastlane/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do
2121

2222

2323

24+
### beta
25+
26+
```sh
27+
[bundle exec] fastlane beta
28+
```
29+
30+
31+
2432
----
2533

2634

0 commit comments

Comments
 (0)