-
Notifications
You must be signed in to change notification settings - Fork 12
154 lines (136 loc) · 5.47 KB
/
multiplatform_snapshot_build.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
name: Multiplatform Snapshot Build
on:
push:
branches:
- dev
pull_request_review:
types: submitted
jobs:
build:
strategy:
matrix:
type: [PublishLibrary, Android, Windows, Linux, macOS, iOS, WasmJs, Js]
include:
- type: PublishLibrary
publish: release
os: macos-latest
- type: Android
android: apk
os: ubuntu-latest
- type: Windows
desktop: msi
os: windows-latest
- type: Linux
desktop: deb
os: ubuntu-latest
- type: macOS
desktop: dmg
os: macos-latest
- type: iOS
iOS: ipa
os: macos-latest
- type: WasmJs
js: wasmJs
os: windows-latest
- type: Js
js: js
os: ubuntu-latest
runs-on: ${{ matrix.os }}
if: ${{ github.event_name != 'pull_request_review' || github.event.review.state == 'approved' }}
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
# Publish Snapshot Library
- name: Publish Library
if: ${{ github.event_name == 'push' && matrix.type == 'PublishLibrary' }}
run: |
./gradlew publishToMavenLocal
./gradlew publish
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
- name: Upload Library Artifact
if: ${{ github.event_name == 'push' && matrix.type == 'PublishLibrary' }}
uses: actions/upload-artifact@v4
with:
name: Repository-${{ github.run_id }}
path: ~/.m2/repository
# Android Build Action
- name: Build Gallery for ${{ matrix.type }}
if: ${{ matrix.android }}
run: |
echo "$ANDROID_KEYSTORE" | base64 --decode > ${{ github.workspace }}/android_sign_key.jks
./gradlew :gallery:assembleRelease
env:
ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }}
ANDROID_SIGNING_FILE: ${{ github.workspace }}/android_sign_key.jks
ANDROID_SIGNING_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
ANDROID_SIGNING_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
ANDROID_SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
- name: Upload android build artifacts
if: ${{ matrix.android }}
uses: actions/upload-artifact@v4
with:
name: Gallery-${{ matrix.type }}-${{ github.run_id }}
path: ${{github.workspace}}/gallery/build/outputs/**/*.${{ matrix.android }}
# Desktop Build Action
- name: Build Gallery for ${{ matrix.type }}
if: ${{ matrix.desktop }}
run: |
./gradlew :gallery:packageReleaseDistributionForCurrentOS
- name: Upload desktop build artifacts
if: ${{ matrix.desktop }}
uses: actions/upload-artifact@v4
with:
name: Gallery-${{ matrix.type }}-${{ github.run_id }}
path: ${{github.workspace}}/gallery/build/compose/binaries/main-release/${{ matrix.desktop }}/*.${{ matrix.desktop }}
# iOS Build Action, Note: Due to the long build time, the iOS build only build the debug version.
- name: Set up Xcode
if: ${{ matrix.iOS }}
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 'latest-stable'
- name: Build Gallery for iOS
if: ${{ matrix.iOS }}
run: |
xcodebuild -scheme iosApp -configuration Debug -sdk iphoneos -archivePath gallery/iosApp/build/Gallery.xcarchive archive -workspace gallery/iosApp/iosApp.xcodeproj/project.xcworkspace CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
- name: Upload iOS Artifact
if: ${{ matrix.iOS }}
uses: actions/upload-artifact@v4
with:
name: Gallery-${{ matrix.type }}-${{ github.run_id }}
path: ${{ github.workspace }}/gallery/iosApp/build/
# Js and WasmJs Build Action
- name: Build Gallery for ${{ matrix.type }}
if: ${{ matrix.js }}
run: |
./gradlew :gallery:${{ matrix.js }}BrowserDistribution
- name: Upload ${{ matrix.type }} build artifacts
if: ${{ matrix.js }}
uses: actions/upload-artifact@v4
with:
name: Gallery-${{ matrix.type }}-${{ github.run_id }}
path: ./gallery/build/dist/${{ matrix.js }}/productionExecutable