update to v0.1, including readme

This commit is contained in:
Lukas Scheuerle (Plagiatus)
2021-03-16 01:09:34 +01:00
parent 497b2b5ea9
commit 58d5eaad1c
4 changed files with 54 additions and 12 deletions
+2 -2
View File
@@ -11,8 +11,8 @@ jobs:
runs-on: ubuntu-latest
name: RCON Test
steps:
- name:
uses: Plagiatus/RCON-Action@v0.0.3
- name: RCON Connection
uses: Plagiatus/RCON-Action@v0.1
with:
server: ${{ secrets.rcon_server }}
port: ${{ secrets.rcon_port }}
+43 -1
View File
@@ -1,3 +1,45 @@
# RCON-Action
Integrate RCON actions into your github workflow
Integrate RCON actions into your github workflow.
Originally created and intended to be used for a more automated use of minecraft datapacks, in tandem with the [FTP Deploy](https://github.com/marketplace/actions/ftp-deploy) action. See [this file](https://github.com/Plagiatus/YeggsMapjam2021/blob/main/.github/workflows/main.yml) for a working example of a combination of these two.
## Example Action File
[File in this repository](https://github.com/Plagiatus/RCON-Action/blob/main/.github/workflows/main.yml)
```yml
name: RCON Test
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
rcon_test:
runs-on: ubuntu-latest
name: RCON Test
steps:
- name: RCON Connection
uses: Plagiatus/RCON-Action@v0.1
with:
server: ${{ secrets.rcon_server }}
port: ${{ secrets.rcon_port }}
password: ${{ secrets.rcon_password }}
commands: '["say hi", "reload"]'
```
## Available Arguments
| name | required | description | default | example |
|-|-|-|-|-|
| server | yes | The server IP | | `127.0.0.1` |
| port | no | The RCON port | `25575` | `12345` |
| password | no | The password | `""` | `Sj3%ka"l` |
| commands | no | Additional commands you want to run, in the form of a JSON String Array | | `'["say hi", "reload"]'` |
| send-push-info | no | Whether a tellraw informing about the push should be sent | `true` | |
| push-info-recipient | no | Changes the selector of the push info tellraw. | `@a` | `@a[tag=admin]` |
It is highly recommended to use [github secrets](https://docs.github.com/en/actions/reference/encrypted-secrets) instead of plaintext inclusions for more sensitive data like the IP or the password.
+3 -2
View File
@@ -5,12 +5,13 @@ inputs:
required: true
description: The server IP address
port:
required: true
required: false
description: The server's RCON port
default: 25575
password:
required: true
required: false
description: The RCON password to authenticate
default: ""
commands:
required: true
description: Additional commands to send
+6 -7
View File
@@ -4,7 +4,7 @@ const rcon = require( "./node-rcon/RCON.js" );
run()
async function run() {
console.log("❤ thank you for using RCON-Action (https://github.com/Plagiatus/RCON-Action).");
console.log("💚 thank you for using RCON-Action ( https://github.com/Plagiatus/RCON-Action ).");
console.log("⭐ if you find this helpful, why not drop a star on the repo? Much appreciated!");
console.log("❓ if you have any questions or issues, please let us know by writing an issue");
@@ -19,23 +19,22 @@ async function run() {
pushInfoRecipient: core.getInput("push-info-recipient"),
}
const payload = JSON.stringify(github.context.payload, undefined, 2);
console.log(inputs);
console.log(payload);
// console.log(inputs);
// console.log(payload);
const srvr = new rcon();
console.log("Connecting to server via RCON...");
await srvr.connect(inputs.server, inputs.port, inputs.password)
console.log("🟢 connected and authenticated");
console.log("🟢 Connected and authenticated.");
if (inputs.sendPushInfo) {
await srvr.send(`tellraw ${inputs.pushInfoRecipient} [{"text":"[GitHub] New push from ","color":"#6D0599"},{"text":"${github.context.payload.sender.login}","color":"#330080"},{"text":" detected and added to the server via ftp."}]`)
await srvr.send(`tellraw ${inputs.pushInfoRecipient} [{"text":"[GitHub] New push from ","color":"gold"},{"text":"${github.context.payload.sender.login}","color":"yellow"},{"text":" detected."}]`)
}
if (inputs.commands.length > 0) {
for (let command of inputs.commands) {
await srvr.send(command);
}
console.log(`📬 Sent all ${inputs.commands.length} to the server.`)
console.log(`📬 Sent all ${inputs.commands.length} additional commands to the server.`)
}
srvr.end();