-
Notifications
You must be signed in to change notification settings - Fork 6
67 lines (64 loc) · 2.47 KB
/
build.yaml
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
# Fails because of this issue below (add comma's back when we get a fix for this)
# https://github.com/gradle/gradle-build-action/issues/758
name: Lint Build and Test
on:
pull_request:
merge_group:
push:
branches: [ main, develop ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# Lints code, builds all modules, runs tests, assembles AAR and APK, and publishes Snapshot
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Calculate Snapshot Version
id: version
# Read version number from the VERSION file and append -SNAPSHOT if not already present
run: |
VERSION=$(cat ./lib/VERSION)
if [[ $VERSION == *"-SNAPSHOT" ]]; then
echo "Version $VERSION already contains -SNAPSHOT"
echo "version=$VERSION" >> $GITHUB_OUTPUT
else
echo "Version $VERSION does not contain -SNAPSHOT"
echo "version=$VERSION-SNAPSHOT" >> $GITHUB_OUTPUT
fi
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build, Test, Lint, Assemble, Publish Snapshot
# NB! The "lint" gradle action here is different than ktLint
run: ./gradlew lint build assembleDebug publish
env:
ORG_GRADLE_PROJECT_VERSION_NAME: ${{ steps.version.outputs.version }}
ORG_GRADLE_PROJECT_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_GPG_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ARTIFACT_GPG_SIGNING_KEY_ID }}
- name: Archive SDK AAR
uses: actions/upload-artifact@v4
with:
name: SDK AAR
path: lib/build/outputs/aar/lib-debug.aar
- name: Archive Sample App
uses: actions/upload-artifact@v4
with:
name: Sample App APK
path: sample/build/outputs/apk/debug/sample-debug.apk
lint:
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- uses: actions/checkout@v4
- uses: musichin/ktlint-check@v3
with:
ktlint-version: "1.2.1"