-
-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (67 loc) · 2.56 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Build
on:
push:
branches:
- master
pull_request:
types:
- opened
- reopened
- synchronize
- labeled
jobs:
build:
# Run on all label events (won't be duplicated) or all push events or on PR syncs not from the same repo
if: github.repository_owner == 'OneLiteFeatherNET'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
cache: gradle
java-version: 17
- name: Clean Build
run: ./gradlew shadowJar --no-daemon
- name: Determine release status
if: ${{ runner.os == 'Linux' }}
run: |
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
echo "STATUS=snapshot" >> $GITHUB_ENV
else
echo "STATUS=release" >> $GITHUB_ENV
fi
- name: Archive Artifacts
uses: actions/upload-artifact@v4
with:
name: FAWESchematicCloud Archive
path: build/libs/FaweSchematicCloud-*.jar
- name: Publish to hangar
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/master'}}
run: ./gradlew publishAllPublicationsToHangar --no-daemon
env:
HANGAR_SECRET: ${{secrets.HANGAR_KEY}}
HANGAR_CHANNEL: "Release"
- name: Publish to hangar snapshot
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/master'}}
run: ./gradlew publishAllPublicationsToHangar --no-daemon
env:
HANGAR_SECRET: ${{secrets.HANGAR_KEY}}
HANGAR_CHANNEL: "Snapshot"
- name: Publish to Modrinth
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/master'}}
run: ./gradlew modrinth --no-daemon
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_KEY }}
MODRINTH_CHANNEL: "release"
SHA_SHORT: ${{steps.vars.outputs.sha_short}}
- name: Publish to Modrinth Snapshot
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/master'}}
run: ./gradlew modrinth --no-daemon
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_KEY }}
MODRINTH_CHANNEL: "beta"