-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (107 loc) · 4.88 KB
/
release.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: CI/CD
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: macos-14
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Get Next Version
id: semver
uses: ietf-tools/semver-action@v1
with:
token: ${{ github.token }}
branch: master
patchList: "refactor, fix, style, chore, perf"
- name: set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'zulu'
- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Android Retrieve the keystore and decode it to a file
env:
ANDROID_RELEASE_KEYSTORE_FILE: ${{ secrets.ANDROID_RELEASE_KEYSTORE_FILE }}
run: |
mkdir release
echo $ANDROID_RELEASE_KEYSTORE_FILE | base64 --decode > release/release.keystore
- name: Android Write local.properties
env:
ANDROID_RELEASE_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_RELEASE_KEYSTORE_PASSWORD }}
ANDROID_RELEASE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEY_ALIAS }}
ANDROID_RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }}
run: |
echo androidReleaseStoreFile=/release/release.keystore >> local.properties
echo androidReleaseStorePassword=$ANDROID_RELEASE_KEYSTORE_PASSWORD >> local.properties
echo androidReleaseKeyAlias=$ANDROID_RELEASE_KEY_ALIAS >> local.properties
echo androidReleaseKeyPassword=$ANDROID_RELEASE_KEY_PASSWORD >> local.properties
- name: Android Build release apk
run: ./gradlew :composeApp:assembleRelease
- name: iOS Update Archive Version
run: |
/usr/libexec/Plistbuddy -c "Set CFBundleVersion ${{ steps.semver.outputs.next }}" "iosApp/iosApp/Info.plist"
/usr/libexec/Plistbuddy -c "Set CFBundleShortVersionString ${{ steps.semver.outputs.next }}" "iosApp/iosApp/Info.plist"
- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.P12_BASE64_KEY }}
P12_PASSWORD: ${{ secrets.P12_KEY_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.MOBILE_PROVISIONING_B64 }}
KEYCHAIN_PASSWORD: ${{ secrets.P12_KEY_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: build archive
run: |
xcodebuild -scheme "iosApp" \
-workspace Untitled.xcworkspace \
-allowProvisioningUpdates \
-archivePath $RUNNER_TEMP/iosApp.xcarchive \
-sdk iphoneos \
-configuration Release \
-destination generic/platform=iOS \
clean archive
- name: export ipa
env:
EXPORT_OPTIONS_PLIST: ${{ secrets.EXPORT_OPTIONS}}
run: |
EXPORT_OPTS_PATH=iosApp/exportOptionsRelease.plist
echo -n "$EXPORT_OPTIONS_PLIST" | base64 --decode -o $EXPORT_OPTS_PATH
xcodebuild -exportArchive -archivePath $RUNNER_TEMP/iosApp.xcarchive -exportOptionsPlist $EXPORT_OPTS_PATH -exportPath build/
- name: Create Release
uses: ncipollo/[email protected]
with:
allowUpdates: true
draft: false
makeLatest: true
name: ${{ steps.semver.outputs.next }}
body: Changelog Contents
token: ${{ github.token }}
artifacts: "composeApp/build/outputs/apk/release/composeApp-release.apk,build/Apps/MGPlayer.ipa"
generateReleaseNotes: true
tag: ${{ steps.semver.outputs.next }}