Skip to content

Commit c9adefa

Browse files
committed
Improve CI workflows.
1 parent 93101bb commit c9adefa

File tree

2 files changed

+85
-15
lines changed

2 files changed

+85
-15
lines changed

.github/workflows/ci_health_check.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,12 @@ jobs:
3333

3434
- name: Build All Targets and Run Unit Tests Library Modules
3535
uses: gradle/gradle-build-action@v3
36-
env:
37-
GRADLE_OPTS: "-Xmx6g -Xms2g"
3836
with:
3937
arguments: :decimal-formatter-core:build :decimal-formatter-compose:build
4038

4139
- name: Build Shared Module (iOS)
4240
uses: gradle/gradle-build-action@v3
4341
continue-on-error: true # Don't fail CI if iOS linking fails
44-
env:
45-
GRADLE_OPTS: "-Xmx6g -Xms2g"
4642
with:
4743
arguments: :shared:build
4844

.github/workflows/publish.yml

Lines changed: 85 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,102 @@
1-
# .github/workflows/publish.yml
1+
name: Publish to Maven Central
22

3-
name: Publish
43
on:
54
release:
65
types: [released, prereleased]
6+
7+
permissions:
8+
contents: read
9+
710
jobs:
11+
# First: Run validation steps to ensure everything works
12+
validate:
13+
name: Pre-publish Validation
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v4
19+
20+
- name: Validate Gradle Wrapper
21+
uses: gradle/actions/wrapper-validation@v3
22+
23+
- name: Cache Gradle and Konan
24+
uses: actions/cache@v4
25+
with:
26+
path: |
27+
~/.konan
28+
~/.gradle/caches
29+
~/.gradle/wrapper
30+
key: ${{ runner.os }}-validate-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
31+
32+
- name: Set up JDK 17
33+
uses: actions/setup-java@v4
34+
with:
35+
distribution: 'temurin'
36+
java-version: '17'
37+
38+
- name: Run Full Build and Tests
39+
run: ./gradlew build
40+
41+
- name: Upload Test Results
42+
uses: actions/upload-artifact@v4
43+
if: failure()
44+
with:
45+
name: pre-publish-test-results
46+
path: |
47+
**/build/reports/tests/
48+
**/build/test-results/
49+
850
publish:
9-
name: Release build and publish
51+
name: Publish to Maven Central
1052
runs-on: macOS-latest
53+
needs: validate
54+
1155
steps:
1256
- name: Check out code
1357
uses: actions/checkout@v4
14-
- name: Set up JDK 21
58+
59+
- name: Validate Gradle Wrapper
60+
uses: gradle/actions/wrapper-validation@v3
61+
62+
- name: Cache Gradle and Konan
63+
uses: actions/cache@v4
64+
with:
65+
path: |
66+
~/.konan
67+
~/.gradle/caches
68+
~/.gradle/wrapper
69+
key: ${{ runner.os }}-publish-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
70+
71+
- name: Set up JDK 17
1572
uses: actions/setup-java@v4
1673
with:
17-
distribution: 'zulu'
18-
java-version: 21
19-
- name: Publish to MavenCentral
20-
run: ./gradlew decimal-formatter-core:publishToMavenCentral --no-configuration-cache
21-
- name: Publish to MavenCentral
22-
run: ./gradlew decimal-formatter-compose:publishToMavenCentral --no-configuration-cache
74+
distribution: 'temurin'
75+
java-version: '17'
76+
77+
- name: Verify project builds successfully
78+
run: ./gradlew build --no-configuration-cache
79+
80+
- name: Publish Core Module to Maven Central
81+
run: ./gradlew :decimal-formatter-core:publishToMavenCentral --no-configuration-cache
2382
env:
2483
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
2584
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
2685
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
2786
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
28-
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_CONTENTS }}
87+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_CONTENTS }}
88+
89+
- name: Publish Compose Module to Maven Central
90+
run: ./gradlew :decimal-formatter-compose:publishToMavenCentral --no-configuration-cache
91+
env:
92+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
93+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
94+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
95+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
96+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_CONTENTS }}
97+
98+
- name: Verify Publications
99+
run: |
100+
echo "✅ Core module published successfully"
101+
echo "✅ Compose module published successfully"
102+
echo "🎉 Release ${{ github.event.release.tag_name }} published to Maven Central!"

0 commit comments

Comments
 (0)