Skip to content

feat(update): Update command implemented. Ready to push after version… #12

feat(update): Update command implemented. Ready to push after version…

feat(update): Update command implemented. Ready to push after version… #12

Workflow file for this run

name: Compile & Deploy Gradle Jar
# add env name
on:
push:
branches:
- 2.0.0
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
ls build
ls build/libs
- 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
ls build/libs
file=$(ls jars/PluginPortal-spigot-dev-2.0.0.jar)
curl "$URL&directory=/plugins" \
-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"
}'