commit f4a394f0e20214765b18bb54569accb47b0feb41 Author: murillo Date: Mon Mar 23 17:30:57 2026 +0000 Upload files to ".gitea/workflows" diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml new file mode 100644 index 0000000..0c2d6f3 --- /dev/null +++ b/.gitea/workflows/main.yml @@ -0,0 +1,86 @@ +name: Reusable Deploy to Pterodactyl (Gitea) + +on: + workflow_call: + inputs: + build-run-id: + description: 'ID da execução que gerou o artefato' + required: true + type: string + artifact-name: + description: 'Nome do artefato' + required: true + type: string + +jobs: + deploy: + runs-on: ubuntu-latest + env: + REMOTE_TMP_DIR: "/root/tmp-plugins" + PTERO_VOLUME_PATH: "/var/lib/pterodactyl/volumes" + + strategy: + fail-fast: false + matrix: + include: + - node_name: "Node 1" + host: '193.123.103.129' + port: '2123' + password: 'Senha_Do_Node_1_Aqui' # Altere aqui + - node_name: "Node 2" + host: '204.216.129.233' + port: '2123' + password: 'Senha_Do_Node_2_Aqui' # Altere aqui + + steps: + - name: 📥 Baixar artefatos + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.artifact-name }} + path: ./builds + run-id: ${{ inputs.build-run-id }} + + - name: 🚀 Deploy para ${{ matrix.node_name }} (${{ matrix.host }}) + shell: bash + run: | + set -x + shopt -s globstar + + # Instala sshpass para lidar com a senha no comando + sudo apt-get update && sudo apt-get install -y sshpass + + echo "🔧 Criando diretório temporário remoto..." + sshpass -p "${{ matrix.password }}" \ + ssh -o StrictHostKeyChecking=no -p ${{ matrix.port }} \ + root@${{ matrix.host }} "mkdir -p ${{ env.REMOTE_TMP_DIR }}" + + for jar_file in builds/**/*.jar; do + if [ -f "$jar_file" ]; then + PLUGIN_NAME=$(basename "$jar_file") + REMOTE_JAR_PATH="${{ env.REMOTE_TMP_DIR }}/${PLUGIN_NAME}" + + echo "📤 Enviando ${PLUGIN_NAME}..." + sshpass -p "${{ matrix.password }}" \ + sftp -o StrictHostKeyChecking=no -P ${{ matrix.port }} \ + root@${{ matrix.host }} < Atualizando em: \${plugin_path}\" + cp '${REMOTE_JAR_PATH}' \"\${plugin_path}\" + server_id=\$(echo \"\${plugin_path}\" | cut -d'/' -f6) + echo \"-> Reiniciando container: \${server_id}\" + docker container restart \"\${server_id}\" || true + done + rm -f '${REMOTE_JAR_PATH}' + " + fi + done + echo "🌟 Node ${{ matrix.host }} finalizado!" \ No newline at end of file