-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (90 loc) · 3.21 KB
/
java-build.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
name: Java SDK Build & Release JDK21
on:
repository_dispatch:
types: [tag-push]
workflow_dispatch:
inputs:
tag:
description: 'source tag'
required: true
type: string
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
jobs:
validation:
name: "gradle-wrapper-validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v3
tagging:
runs-on: ubuntu-latest
outputs:
tag: ${{ env.tag }}
version: ${{ env.version }}
prerelease: ${{ env.prerelease }}
steps:
- name: Use the tag from the event
id: tag
run: |
TAG="${{ inputs.tag || github.event.client_payload.tag }}"
VERSION=${TAG#v}
echo "TAG from event: ${TAG}"
echo "tag=${TAG}" >> $GITHUB_ENV
echo "version=${VERSION}">> $GITHUB_ENV
if [[ "${TAG}" == *-* ]]; then echo "prerelease=true" >> $GITHUB_ENV; else echo "prerelease=false" >> $GITHUB_ENV; fi
publish:
needs:
- validation
- tagging
runs-on: ubuntu-latest
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralUsername }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralPassword }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyId }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyPassword }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKey }}
steps:
- uses: actions/checkout@v4
- name: Checkout proto repository
run: |
git clone https://github.com/KodyPay/kp-protocols-clientsdk.git proto-repo
mv proto-repo/src .
rm -r proto-repo
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'adopt'
- name: Setup & Build Gradle
uses: gradle/actions/setup-gradle@v3
with:
arguments: build -s --scan -Pversion=${{ needs.tagging.outputs.version }}
- name: Setup git config
run: |
echo "Setting up Git user information"
git config --global user.name "${{github.actor}}"
git config --global user.email "<>"
- name: Publish candidate
if: ${{ needs.tagging.outputs.prerelease }}
run: ./gradlew candidate -Prelease.version=${{ needs.tagging.outputs.version }} -s
- name: Publish release
if: ${{ !needs.tagging.outputs.prerelease }}
run: ./gradlew final -Prelease.version=${{ needs.tagging.outputs.version }} -s
release:
needs:
- tagging
- publish
runs-on: ubuntu-latest
steps:
- name: Create Release
uses: ncipollo/[email protected]
with:
name: "${{ needs.tagging.outputs.tag }}"
tag: "${{ needs.tagging.outputs.tag }}"
omitBody: true
draft: false
prerelease: ${{ needs.tagging.outputs.prerelease }}
makeLatest: ${{ !needs.tagging.outputs.prerelease }}