Skip to content

Do not build the standard .jar, only the shadow jar #43

Do not build the standard .jar, only the shadow jar

Do not build the standard .jar, only the shadow jar #43

Workflow file for this run

name: Compile & Deploy Gradle Jar
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: "adopt"
java-version: "17"
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Cache Gradle Dependencies
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: gradle-${{ runner.os }}-
- name: Create build directory
run: mkdir -p build
- name: Gradle build
run: |
echo "REPO_NAME=${{ github.event.repository.name }}" >> $GITHUB_ENV
./gradlew build -PoutputDir=build
- name: Install JQ
run: sudo apt-get install jq
- name: Obtain Pterodactyl upload endpoint
run: |
response=$(curl "https://${{ vars.PTERO_HOST }}/api/client/servers/${{ vars.PTERO_SERVER_ID }}/files/upload" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${{ secrets.PTERO_API_KEY }}' \
-X GET)
url=$(echo "$response" | jq -r .attributes.url)
echo "URL=$url" >> $GITHUB_ENV
- name: Upload jar to Pterodactyl upload endpoint
run: |
echo $URL
echo $REPO_NAME
file=$(ls build/libs/$REPO_NAME.jar)
curl "$URL" \
-H 'Content-Type: multipart/form-data' \
-F "files=@$file" \
-X POST
- name: Restart Pterodactyl server
run: |
curl "https://${{ vars.PTERO_HOST }}/api/client/servers/${{ vars.PTERO_SERVER_ID }}/power" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${{ secrets.PTERO_API_KEY }}' \
-X POST \
-d '{
"signal": "restart"
}'