forked from mockative/mockative
-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (113 loc) · 4.32 KB
/
release.yml
File metadata and controls
125 lines (113 loc) · 4.32 KB
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
name: Release
on:
workflow_dispatch:
release:
types: [ created ]
env:
SONATYPE_BASE_URL: https://s01.oss.sonatype.org/service/local/
jobs:
create-staging-repository:
runs-on: ubuntu-latest
name: Create staging repository
outputs:
repository-id: ${{ steps.create.outputs.repository_id }}
steps:
- id: create
name: Create staging repository
uses: nexus-actions/create-nexus-staging-repo@v1.3.0
with:
username: ${{ secrets.SONATYPE_USERNAME }}
password: ${{ secrets.SONATYPE_PASSWORD }}
staging_profile_id: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
base_url: ${{ env.SONATYPE_BASE_URL }}
description: Created by Release (Create staging repository) for mockative/mockative
publish-on-macos:
runs-on: macos-15
needs:
- create-staging-repository
env:
DEVELOPER_DIR: /Applications/Xcode_16.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Publish to Maven Central
shell: bash
run: |
./gradlew publishAllPublicationsToSonatypeRepository \
-Pmockative.projects=':mockative-plugin,:mockative,:mockative-processor'
-Psigning.key='${{ secrets.SIGNING_KEY }}' \
-Psigning.keyId='${{ secrets.SIGNING_KEY_ID }}' \
-Psigning.password='${{ secrets.SIGNING_PASSWORD }}' \
-Psonatype.username='${{ secrets.SONATYPE_USERNAME }}' \
-Psonatype.password='${{ secrets.SONATYPE_PASSWORD }}' \
-Psonatype.repository='${{ needs.create-staging-repository.outputs.repository-id }}'
- name: Publish Plugin to Gradle Plugin Portal
shell: bash
run: |
./gradlew publishPlugins \
-Pmockative.projects=':mockative-plugin'
-Psigning.key='${{ secrets.SIGNING_KEY }}' \
-Psigning.keyId='${{ secrets.SIGNING_KEY_ID }}' \
-Psigning.password='${{ secrets.SIGNING_PASSWORD }}' \
-Pgradle.publish.key='${{ secrets.GRADLE_PUBLISH_KEY }}' \
-Pgradle.publish.secret='${{ secrets.GRADLE_PUBLISH_SECRET }}'
macos-host-check:
name: Check on macOS
runs-on: macos-15
needs:
- create-staging-repository
- publish-on-macos
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Check
run: |
./gradlew :tools:check-publication:build \
-Pmockative.projects=':tools:check-publication' \
-Psonatype.username='${{ secrets.SONATYPE_USERNAME }}' \
-Psonatype.password='${{ secrets.SONATYPE_PASSWORD }}' \
-Psonatype.repository='${{ needs.create-staging-repository.outputs.repository-id }}'
close-staging-repository:
runs-on: ubuntu-latest
needs:
- create-staging-repository
- macos-host-check
if: ${{ always() && needs.create-staging-repository.result == 'success' }}
steps:
# - name: Discard
# if: ${{ needs.macos-host-check.result != 'success' }}
# uses: nexus-actions/drop-nexus-staging-repo@v1
# with:
# username: ${{ secrets.SONATYPE_USERNAME }}
# password: ${{ secrets.SONATYPE_PASSWORD }}
# base_url: ${{ env.SONATYPE_BASE_URL }}
# staging_repository_id: ${{ needs.create-staging-repository.outputs.repository-id }}
- name: Close
if: ${{ needs.macos-host-check.result == 'success' }}
uses: nexus-actions/release-nexus-staging-repo@v1.3.0
with:
username: ${{ secrets.SONATYPE_USERNAME }}
password: ${{ secrets.SONATYPE_PASSWORD }}
staging_repository_id: ${{ needs.create-staging-repository.outputs.repository-id }}
base_url: ${{ env.SONATYPE_BASE_URL }}
close_only: true