forked from square/wire-grpc-server
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (68 loc) · 2.56 KB
/
Copy pathbuild.yml
File metadata and controls
82 lines (68 loc) · 2.56 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
name: build
on:
pull_request: {}
workflow_dispatch: {}
push:
branches:
- 'main'
tags-ignore:
- '**'
env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false"
jobs:
jvm:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Configure JDK
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
with:
distribution: 'zulu'
java-version: 17
- name: Test
run: |
./gradlew build --stacktrace --warning-mode all
publish-snapshot:
name: Publish to Maven Central
runs-on: ubuntu-latest
if: github.repository == 'pkware/pk-wire-grpc-server' && github.ref == 'refs/heads/main'
needs: [jvm]
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Configure JDK
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
with:
distribution: 'temurin'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 # zizmor: ignore[cache-poisoning]
- name: Publish to Maven Central
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
ORG_GRADLE_PROJECT_SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
- name: Check if release version
id: version-check
run: |
version=$(./gradlew properties -q | grep "^version:" | cut -d' ' -f2)
if [[ "$version" != *"-SNAPSHOT" ]]; then
echo "is_release=true" >> "$GITHUB_OUTPUT"
fi
- name: Notify Central Publisher Portal
if: steps.version-check.outputs.is_release == 'true'
run: |
token=$(echo -n "${{ secrets.NEXUS_USERNAME }}:${{ secrets.NEXUS_PASSWORD }}" | base64)
curl -X POST \
--max-time 30 \
--fail-with-body \
-H "Authorization: Bearer $token" \
"https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/com.pkware.wiregrpcserver?publishing_type=automatic"