-
Notifications
You must be signed in to change notification settings - Fork 12
106 lines (93 loc) · 4.32 KB
/
tf.yml
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
name: TestFlight Alternative Deploy
on:
workflow_dispatch:
inputs:
buildv:
required: true
jobs:
build:
name: Build & Deploy
runs-on: macos-14
permissions:
contents: write
pull-requests: write
issues: write
repository-projects: write
checks: write
statuses: write
env:
ASCAPI_ISSUER_ID: ${{ secrets.ALT_ISSUER_ID }}
ASCAPI_KEY_ID: ${{ secrets.ALT_KEY_ID }}
ASCAPI_KEY: ${{ secrets.ALT_KEY }}
GH_TOKEN: ${{ github.token }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.psha }}
- name: Set Xcode Version
run: sudo xcode-select -s /Applications/Xcode_15.2.app
- name: Prepare Version Folder
run: mkdir vers
- name: Checkout Version Files
uses: actions/checkout@v3
with:
ref: release-vers
persist-credentials: false
fetch-depth: 0
path: vers
- name: Change Project Version
env:
TARGET_TAG: ${{ inputs.buildv }}
run: sed -i '' "s|CURRENT_PROJECT_VERSION = [0-9]*;|CURRENT_PROJECT_VERSION = $TARGET_TAG;|g" ./DarockBili.xcodeproj/project.pbxproj
- name: Install the Apple certificate and provisioning profile for Xcode
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.ALT_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.ALT_P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.ALT_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Prepare Abouts
env:
github_ref: ${{ github.ref }}
run: |
IFS='/' read -ra parts <<< "$github_ref"
last_index=$((${#parts[@]} - 1))
CI_TAG="${parts[$last_index]}"
sed -i '' "s|.*|Linecom|" ./CurrentChannel.drkdatac
sed -i '' "s|.*|${CI_TAG}|" ./SemanticVersion.drkdatas
rm "/Users/runner/work/Darock-Bili/Darock-Bili/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved"
- name: Resolve Package Dependencies
run: xcodebuild -resolvePackageDependencies -project ./DarockBili.xcodeproj -scheme 'Alternative Destribution' -configuration Alternative
- name: Archive DarockBili App
run: |
xcodebuild archive -project ./DarockBili.xcodeproj -scheme 'Alternative Destribution' -archivePath ./build.xcarchive -IDEPostProgressNotifications=YES CODE_SIGN_IDENTITY=- AD_HOC_CODE_SIGNING_ALLOWED=YES CODE_SIGN_STYLE=Automatic DEVELOPMENT_TEAM=B38QUJMY47 COMPILER_INDEX_STORE_ENABLE=NO -configuration Alternative -quiet
- name: Export IPA File
run: |
xcodebuild -exportArchive -archivePath ./build.xcarchive -exportPath ./ -exportOptionsPlist ./ExportOptions/app-store.plist -DVTProvisioningIsManaged=YES -DVTSkipCertificateValidityCheck=YES
- name: Prepare API Key
run: |
mkdir ~/.private_keys
echo "$ASCAPI_KEY" >> ~/.private_keys/AuthKey_${ASCAPI_KEY_ID}.p8
- name: Upload to App Store Connect
run: |
ls
xcrun altool --upload-app -f ./MeowBili.ipa -t ios --apiKey $ASCAPI_KEY_ID --apiIssuer $ASCAPI_ISSUER_ID