name: Autozip Pack on: push: branches-ignore: [ main, master ] workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: # Sets up SSH agent (easier than creating folders, config, and authorized_keys) - name: Set up SSH authentication uses: webfactory/ssh-agent@v0.9.0 with: ssh-private-key: ${{ secrets.VPS_SSH_KEY }} # Fetches the branch files on the runner - name: Get updated branch uses: actions/checkout@v6 # 1 - zips the pack # 2 - creates subdirectories (rsync doesn't always do that) # 3 - transfers file to server - name: "Zip and upload pack" run: | echo "Creating resource pack zip..." ZIP_NAME=$(echo "${{ vars.ZIP_NAME_TEMPLATE }}" | sed "s|%VERSION%|${{ github.ref_name }}|") ZIP_FILENAME=${ZIP_NAME}.${{ vars.ZIP_EXTENSION }} FINAL_LOCATION="${{ vars.ZIP_PATH }}/${ZIP_FILENAME}" zip -r "${ZIP_FILENAME}" . -x ".*" -x "*/.*" echo "Creating directory ${{ vars.ZIP_PATH }} on server..." SSH_ADDRESS="${{ secrets.VPS_USERNAME }}@${{ secrets.VPS_HOST_IP }}" ssh -p ${{ secrets.VPS_SSH_PORT }} -o StrictHostKeyChecking=no \ "$SSH_ADDRESS" \ "mkdir -p \"${{ vars.ZIP_PATH }}\"" echo "Uploading file to server..." rsync -havzP \ -e "ssh -p ${{ secrets.VPS_SSH_PORT }} -o StrictHostKeyChecking=no" \ "${ZIP_FILENAME}" \ "${SSH_ADDRESS}:${FINAL_LOCATION}" echo "File uploaded to $FINAL_LOCATION"