-
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (42 loc) · 1.58 KB
/
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
name: Build
on: [
workflow_dispatch,
push
]
jobs:
build:
name: Build & Publish
runs-on: ubuntu-latest
permissions:
contents: read
env:
BUILD_NUMBER: "${{ github.run_number }}"
COMMIT_MESSAGE: "${{ github.event.head_commit.message }}"
steps:
- uses: actions/checkout@v4
name: Checkout sources
- uses: actions/setup-java@v4
name: Set up JDK 17
with:
java-version: '17'
distribution: 'temurin'
- uses: gradle/actions/setup-gradle@v4
name: Setup Gradle
- name: Build Artifact
run: "chmod +x ./gradlew && ./gradlew build $([[ \"$COMMIT_MESSAGE\" == \"release:\"* ]] && echo || echo -PBUILD_NUMBER=$BUILD_NUMBER)"
- uses: actions/upload-artifact@v4
name: Save Artifact
with:
name: "AdriAPI-b${{ github.run_number }}"
path: build/libs/*.jar
- name: Publish Artifact
if: github.repository == 'Adrigamer2950/AdriAPI'
env:
NEXUS_USERNAME: "${{ secrets.NEXUS_USERNAME }}"
NEXUS_PASSWORD: "${{ secrets.NEXUS_PASSWORD }}"
run: "./gradlew publish -PNEXUS_USERNAME=$NEXUS_USERNAME -PNEXUS_PASSWORD=$NEXUS_PASSWORD $([[ \"$COMMIT_MESSAGE\" == \"release:\"* ]] && echo \"\" || echo \"-PBUILD_NUMBER=$BUILD_NUMBER\")"
- name: Publish to Modrinth
if: "${{ github.repository == 'Adrigamer2950/AdriAPI' && startsWith(github.event.head_commit.message, 'release:') }}"
env:
MODRINTH_TOKEN: "${{ secrets.MODRINTH_TOKEN }}"
run: "./gradlew modrinth modrinthSyncBody"