-
Notifications
You must be signed in to change notification settings - Fork 83
81 lines (77 loc) · 3.48 KB
/
publish.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
on:
[workflow_dispatch]
jobs:
create_staging_repository:
runs-on: ubuntu-latest
name: Create staging repository
outputs:
repository_id: ${{ steps.create.outputs.repository_id }}
steps:
- id: create
uses: nexus-actions/[email protected]
with:
base_url: https://s01.oss.sonatype.org/service/local/
description: ${{ github.repository }}/${{ github.workflow }}#${{ github.run_number }}
username: ${{ secrets.NEXUS_ACTIONS_SONATYPE_USERNAME }}
password: ${{ secrets.NEXUS_ACTIONS_SONATYPE_PASSWORD }}
staging_profile_id: ${{ secrets.NEXUS_ACTIONS_SONATYPE_PROFILE_ID }}
macos:
runs-on: macos-latest
needs: create_staging_repository
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Configure JDK
uses: actions/setup-java@v1
with:
java-version: 14
- name: Publish
run: |
./gradlew publishAllPublicationsToMavenRepository -PSONATYPE_REPOSITORY_ID=${{ needs.create_staging_repository.outputs.repository_id }}
env:
MANUAL_REPOSITORY: ${{ secrets.MANUAL_REPOSITORY }}
SONATYPE_REPOSITORY_ID: ${{ needs.create_staging_repository.outputs.repository_id }}
SONATYPE_USERNAME: ${{ secrets.NEXUS_ACTIONS_SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.NEXUS_ACTIONS_SONATYPE_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.NEXUS_ACTIONS_GPG_PRIVATE_KEY }}
GPG_PRIVATE_PASSWORD: ${{ secrets.NEXUS_ACTIONS_GPG_PRIVATE_PASSWORD }}
windows:
runs-on: windows-latest
needs: create_staging_repository
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Configure JDK
uses: actions/setup-java@v1
with:
java-version: 14
- name: Publish
run: |
./gradlew publishMingwX64PublicationToMavenRepository -PSONATYPE_REPOSITORY_ID=${{ needs.create_staging_repository.outputs.repository_id }}
env:
MANUAL_REPOSITORY: ${{ secrets.MANUAL_REPOSITORY }}
SONATYPE_REPOSITORY_ID: ${{ needs.create_staging_repository.outputs.repository_id }}
SONATYPE_USERNAME: ${{ secrets.NEXUS_ACTIONS_SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.NEXUS_ACTIONS_SONATYPE_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.NEXUS_ACTIONS_GPG_PRIVATE_KEY }}
GPG_PRIVATE_PASSWORD: ${{ secrets.NEXUS_ACTIONS_GPG_PRIVATE_PASSWORD }}
finalize:
runs-on: ubuntu-latest
needs: [create_staging_repository,macos,windows]
if: ${{ always() && needs.create_staging_repository.result == 'success' }}
steps:
- name: Discard
if: ${{ needs.macos.result != 'success' || needs.windows.result != 'success' }}
uses: nexus-actions/drop-nexus-staging-repo@main
with:
username: ${{ secrets.NEXUS_ACTIONS_SONATYPE_USERNAME }}
password: ${{ secrets.NEXUS_ACTIONS_SONATYPE_PASSWORD }}
staging_repository_id: ${{ needs.create_staging_repository.outputs.repository_id }}
- name: Release
if: ${{ needs.macos.result == 'success' && needs.windows.result == 'success' }}
uses: nexus-actions/release-nexus-staging-repo@main
with:
base_url: https://s01.oss.sonatype.org/service/local/
username: ${{ secrets.NEXUS_ACTIONS_SONATYPE_USERNAME }}
password: ${{ secrets.NEXUS_ACTIONS_SONATYPE_PASSWORD }}
staging_repository_id: ${{ needs.create_staging_repository.outputs.repository_id }}