-
Notifications
You must be signed in to change notification settings - Fork 18
49 lines (43 loc) · 1.36 KB
/
publish-snapshot.yaml
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
name: Publish Snapshot
on:
push:
branches:
- main
workflow_dispatch:
jobs:
check-version:
runs-on: ubuntu-latest
outputs:
is_snapshot: ${{ steps.check_snapshot.outputs.is_snapshot }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Check for SNAPSHOT suffix
id: check_snapshot
run: |
VERSION_NAME=$(grep "^VERSION_NAME=" gradle.properties | cut -d '=' -f 2)
if [[ $VERSION_NAME == *-SNAPSHOT ]]; then
echo "::set-output name=is_snapshot::true"
else
echo "::set-output name=is_snapshot::false"
fi
publish:
name: Publish to Snapshot
runs-on: ubuntu-latest
needs: check-version
if: ${{ needs.check-version.outputs.is_snapshot == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Upload Artifacts
run: ./gradlew publishAllPublicationsToMavenCentralRepository
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}