-
-
Notifications
You must be signed in to change notification settings - Fork 160
155 lines (155 loc) · 6.07 KB
/
publish-to-maven-central.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
155
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: Publish to Maven Central
on:
workflow_dispatch:
pull_request:
types: [opened]
paths:
- 'libraries_version.txt'
branches:
- release
jobs:
create-staging-repository:
name: Create staging repository
runs-on: ubuntu-latest
outputs:
repository_id: ${{ steps.create.outputs.repository_id }}
steps:
- id: create
uses: nexus-actions/create-nexus-staging-repo@v1.1
with:
username: ${{ secrets.SONATYPE_USERNAME }}
password: ${{ secrets.SONATYPE_PASSWORD }}
staging_profile_id: ${{ secrets.SONATYPE_PROFILE_ID }}
description: ${{ github.repository }}/${{ github.workflow }}#${{ github.run_number }}
linux-upload:
runs-on: ubuntu-latest
needs: [create-staging-repository]
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Configure JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Upload all artifacts Linux can build
run: >-
./gradlew --scan --console=plain
publishAllPublicationsToMavenCentralStagingRepository
env:
sonatype_staging_repo_id: ${{ needs.create-staging-repository.outputs.repository_id }}
windows-upload:
runs-on: windows-latest
needs: [create-staging-repository]
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Configure JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Upload Windows x64 bits artifacts
run: >-
./gradlew --scan --console=plain
publishMingwX64PublicationToMavenCentralStagingRepository
env:
sonatype_staging_repo_id: ${{ needs.create-staging-repository.outputs.repository_id }}
macos-upload:
runs-on: macos-latest
needs: [create-staging-repository]
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Configure JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Upload Darwin artifacts
run: >-
./gradlew --scan --console=plain
publishIosArm32PublicationToMavenCentralStagingRepository
publishIosArm64PublicationToMavenCentralStagingRepository
publishIosX64PublicationToMavenCentralStagingRepository
publishMacosX64PublicationToMavenCentralStagingRepository
publishWatchosArm32PublicationToMavenCentralStagingRepository
publishWatchosArm64PublicationToMavenCentralStagingRepository
publishWatchosX86PublicationToMavenCentralStagingRepository
env:
sonatype_staging_repo_id: ${{ needs.create-staging-repository.outputs.repository_id }}
linux-checking:
runs-on: ubuntu-latest
needs: [create-staging-repository, linux-upload]
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Configure JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Check Linux build with latest artifacts
run: ./gradlew --scan :tools:publication-checker:build
env:
check_publication: true
sonatype_staging_repo_id: ${{ needs.create-staging-repository.outputs.repository_id }}
windows-checking:
runs-on: windows-latest
needs: [create-staging-repository, linux-upload, windows-upload]
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Configure JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Check Windows build with latest artifacts
run: ./gradlew --scan :tools:publication-checker:build
env:
check_publication: true
sonatype_staging_repo_id: ${{ needs.create-staging-repository.outputs.repository_id }}
macos-checking:
runs-on: macos-latest
needs: [create-staging-repository, linux-upload, macos-upload]
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Configure JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Check macOS build with latest artifacts
run: ./gradlew --scan :tools:publication-checker:build
env:
check_publication: true
sonatype_staging_repo_id: ${{ needs.create-staging-repository.outputs.repository_id }}
finalize:
runs-on: ubuntu-latest
needs: [create-staging-repository, windows-checking, macos-checking, linux-checking]
if: ${{ always() && needs.create-staging-repository.result == 'success' }}
steps:
- name: Discard staging repository
if: ${{ needs.windows-checking.result != 'success' || needs.macos-checking.result != 'success' || needs.linux-checking.result != 'success' }}
uses: nexus-actions/drop-nexus-staging-repo@v1
with:
username: ${{ secrets.SONATYPE_USERNAME }}
password: ${{ secrets.SONATYPE_PASSWORD }}
staging_repository_id: ${{ needs.create-staging-repository.outputs.repository_id }}
- name: Release
if: ${{ needs.windows-checking.result == 'success' && needs.macos-checking.result == 'success' && needs.linux-checking.result == 'success' }}
uses: nexus-actions/release-nexus-staging-repo@v1.1
with:
username: ${{ secrets.SONATYPE_USERNAME }}
password: ${{ secrets.SONATYPE_PASSWORD }}
staging_repository_id: ${{ needs.create-staging-repository.outputs.repository_id }}
env:
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx5g -XX:+UseParallelGC -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
sonatype_username: ${{ secrets.SONATYPE_USERNAME }}
sonatype_password: ${{ secrets.SONATYPE_PASSWORD }}
GPG_key_id: ${{ secrets.GPG_KEY_ID }}
GPG_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_private_password: ${{ secrets.GPG_PRIVATE_PASSWORD }}