|
1 | 1 | name: Build |
2 | 2 |
|
3 | | -on: |
4 | | - release: |
5 | | - types: [published] |
6 | | - workflow_dispatch: |
| 3 | +on: [push, pull_request] |
7 | 4 |
|
8 | 5 | jobs: |
9 | 6 | build: |
10 | | - |
11 | 7 | runs-on: ubuntu-latest |
| 8 | + permissions: |
| 9 | + contents: read |
12 | 10 |
|
13 | 11 | steps: |
14 | | - - uses: actions/checkout@v3 |
15 | | - - name: Set up JDK |
16 | | - uses: actions/setup-java@v3 |
17 | | - with: |
18 | | - java-version: '25' |
19 | | - distribution: 'temurin' |
20 | | - cache: maven |
21 | | - server-id: central |
22 | | - server-username: CENTRAL_USERNAME |
23 | | - server-password: CENTRAL_TOKEN |
24 | | - gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} |
25 | | - gpg-passphrase: GPG_PASSPHRASE |
26 | | - |
27 | | - - name: Initialize Paper NMS |
28 | | - run: for file in $(grep -l '<artifactId>paper-nms</artifactId>' $(find -name 'pom.xml')); do mvn -B paper-nms:init --file "$file"; done |
29 | | - |
30 | | - - name: Build the dependencies of the api |
31 | | - run: mvn -B install --file pom.xml -pl '!api' |
32 | | - |
33 | | - - name: Build and deploy the api |
34 | | - working-directory: ./api |
35 | | - run: mvn -B deploy --file pom.xml |
36 | | - env: |
37 | | - CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} |
38 | | - CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }} |
39 | | - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + |
| 14 | + - name: Set up JDK 21 and 25 |
| 15 | + uses: actions/setup-java@v4 |
| 16 | + with: |
| 17 | + distribution: temurin |
| 18 | + java-version: | |
| 19 | + 21 |
| 20 | + 25 |
| 21 | + cache: maven |
| 22 | + |
| 23 | + - name: Initialize Paper NMS |
| 24 | + run: | |
| 25 | + for file in $(grep -l '<artifactId>paper-nms</artifactId>' $(find . -name 'pom.xml')); do |
| 26 | + mvn -B paper-nms:init --file "$file" |
| 27 | + done |
| 28 | +
|
| 29 | + - name: Build |
| 30 | + run: mvn -B install --file pom.xml -DskipTests |
| 31 | + |
| 32 | + - name: Upload SignGUI jar |
| 33 | + uses: actions/upload-artifact@v4 |
| 34 | + with: |
| 35 | + name: signgui-build |
| 36 | + path: api/target/signgui-*.jar |
| 37 | + if-no-files-found: error |
| 38 | + |
| 39 | + - name: Publish snapshot to Reposilite |
| 40 | + if: github.event_name == 'push' |
| 41 | + run: | |
| 42 | + VERSION=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version --file pom.xml) |
| 43 | + echo "Project version: $VERSION" |
| 44 | + if [[ "$VERSION" != *-SNAPSHOT ]]; then |
| 45 | + echo "Not a SNAPSHOT version — skipping snapshot publish." |
| 46 | + exit 0 |
| 47 | + fi |
| 48 | + if [ -z "${REPOSILITE_USER}" ] || [ -z "${REPOSILITE_TOKEN}" ]; then |
| 49 | + echo "Missing REPOSILITE_USER / REPOSILITE_TOKEN secrets." |
| 50 | + exit 1 |
| 51 | + fi |
| 52 | + mvn -B deploy --file pom.xml -pl api -am -DskipTests \ |
| 53 | + --settings .github/maven-settings.xml |
| 54 | + env: |
| 55 | + REPOSILITE_USER: ${{ secrets.REPOSILITE_USER }} |
| 56 | + REPOSILITE_TOKEN: ${{ secrets.REPOSILITE_TOKEN }} |
0 commit comments