Merge pull request #21 from unldenis/support-1.21.8-/-1.21.11 #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Deploy Plugin | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '8' | |
| distribution: 'temurin' | |
| - name: Build plugin with Maven | |
| run: mvn clean package | |
| - name: Upload Corpse plugin JAR | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Corpse-plugin | |
| path: target/Corpse-*.jar | |
| - name: Deploy shaded plugin to VPS | |
| run: | | |
| # Find the shaded JAR (exclude original-*.jar) | |
| SHADED_JAR=$(find target -name "*.jar" ! -name "original-*.jar" | head -1) | |
| if [ -z "$SHADED_JAR" ]; then | |
| echo "Error: Shaded JAR not found" | |
| exit 1 | |
| fi | |
| # Save SSH key temporarily | |
| echo "${{ secrets.VPS_KEY }}" > /tmp/vps_key | |
| chmod 600 /tmp/vps_key | |
| # Copy only the shaded JAR directly to plugins folder, renamed to Corpse.jar | |
| scp -i /tmp/vps_key -o StrictHostKeyChecking=no -P 22 \ | |
| "$SHADED_JAR" \ | |
| ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }}:/root/mcserver/server/plugins/Corpse.jar | |
| # Clean up | |
| rm -f /tmp/vps_key | |
| - name: Restart Minecraft server | |
| uses: appleboy/ssh-action@v0.1.7 | |
| with: | |
| host: ${{ secrets.VPS_HOST }} | |
| username: ${{ secrets.VPS_USER }} | |
| key: ${{ secrets.VPS_KEY }} | |
| port: 22 | |
| script: | | |
| cd /root/mcserver | |
| docker compose down | |
| docker compose up -d |