-
Notifications
You must be signed in to change notification settings - Fork 1
96 lines (82 loc) · 3.2 KB
/
deploy.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
name: Deploy to Maven Central
on:
push:
branches:
- main # Trigger deployment only on the main branch
permissions:
contents: read
id-token: write
jobs:
deploy:
runs-on: macos-latest # Use macOS for iOS builds
steps:
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Step 2: Set up JDK
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Install Xcode Command Line Tools
run: |
xcode-select --install || echo "Xcode Command Line Tools already installed"
# Step 3: Import GPG key (securely)
- name: Import GPG key
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import
echo "use-agent" >> ~/.gnupg/gpg.conf
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
gpg --list-secret-keys --keyid-format LONG > /dev/null
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
# Step 4: Configure Maven settings (securely)
- name: Configure Maven settings
run: |
mkdir -p ~/.m2
cat <<EOF > ~/.m2/settings.xml
<settings>
<servers>
<server>
<id>ossrh</id>
<username>${{ secrets.OSSRH_USERNAME }}</username>
<password>${{ secrets.OSSRH_PASSWORD }}</password>
</server>
</servers>
</settings>
EOF
- name: Verify Maven settings
run: ls -la ~/.m2
- name: Verify gradle tasks Available
uses: ./gradlew tasks
- name: Build Android and Common Artifacts
run: ./gradlew clean assemble --no-configuration-cache
- name: Build iOS Artifacts
run: |
./gradlew :shared:linkReleaseFrameworkIosArm64
./gradlew :shared:linkReleaseFrameworkIosSimulatorArm64
# Step 5: Verify Generated Artifacts for Kotlin Multiplatform
- name: Verify Generated Artifacts
run: |
if [ ! -d "./shared/build/libs" ]; then
echo "No artifacts found for Android! Ensure the Android artifacts are generated in './shared/build/libs'."
exit 1
fi
if [ ! -d "./shared/build/bin/iosArm64" ]; then
echo "No artifacts found for iOS Arm64! Ensure the iOS artifacts are generated in './shared/build/bin/iosArm64'."
exit 1
fi
if [ ! -d "./shared/build/bin/iosSimulatorArm64" ]; then
echo "No artifacts found for iOS Simulator Arm64! Ensure the iOS artifacts are generated in './shared/build/bin/iosSimulatorArm64'."
exit 1
fi
echo "Artifacts verified successfully!"
# Step 6: Build and Publish to Maven Central
- name: Build and publish
run: ./gradlew clean publishAllPublicationsToMavenCentralRepository --no-configuration-cache --info --stacktrace
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}