hay que cambiar esto, importante
Some checks failed
Update Bot / restart-bot (push) Has been cancelled
Update Bot / deploy-via-sftp (push) Has been cancelled

This commit is contained in:
2025-10-26 22:06:43 +01:00
parent 767874c246
commit b980aa70e3

View File

@@ -18,15 +18,12 @@ jobs:
host: 172.17.0.1 host: 172.17.0.1
user: binlab user: binlab
pass: ${{ secrets.KEY }} pass: ${{ secrets.KEY }}
args: '-vvv'
deploy-via-sftp: deploy-via-sftp:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@latest - uses: actions/checkout@v2
with:
github-server-url: 'http://20.251.208.74:3000'
- id: SFTPDeploy - id: SFTPDeploy
uses: https://github.com/wlixcc/SFTP-Deploy-Action@v1.2.4 uses: https://github.com/wlixcc/SFTP-Deploy-Action@v1.2.4
with: with:
@@ -36,7 +33,7 @@ jobs:
# clones entire github repo # clones entire github repo
local_path: ./* local_path: ./*
# destination of the code on the server # destination of the code on the server
remote_path: /home/admin/${{ env.REPO_NAME }}/ remote_path: /home/binlab/${{ env.REPO_NAME }}/
password: ${{ secrets.KEY }} password: ${{ secrets.KEY }}
ssh_private_key: ignored ssh_private_key: ignored
@@ -47,7 +44,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 2 timeout-minutes: 2
env: env:
BOT_TOKEN: ${{ secrets.BOT_TOKEN }} BOT_TOKEN: ${{ secrets.TOKEN }}
steps: steps:
- id: add-bot-token - id: add-bot-token
uses: https://github.com/fifsky/ssh-action@master uses: https://github.com/fifsky/ssh-action@master
@@ -59,7 +56,7 @@ jobs:
echo $? echo $?
host: 172.17.0.1 host: 172.17.0.1
user: binlab user: binlab
pass: ${{ secrets.SSH_PRIVATE_KEY }} pass: ${{ secrets.KEY }}
create-systemctl-service: create-systemctl-service:
needs: [add-bot-token, deploy-via-sftp] needs: [add-bot-token, deploy-via-sftp]
@@ -70,25 +67,26 @@ jobs:
with: with:
# Make sure ExecStart=, WorkingDirectory= and chmod +x point to the same directory. These may be unique to your code setup # Make sure ExecStart=, WorkingDirectory= and chmod +x point to the same directory. These may be unique to your code setup
command: | command: |
sudo touch /etc/systemd/system/${{ env.REPO_NAME }}.service; chmod /etc/systemd/system/${{ env.REPO_NAME }}.service 666
echo "[Unit] echo "[Unit]
Description=${{ env.REPO_NAME }} Discord Bot Description=${{ env.REPO_NAME }} Discord Bot
After=multi-user.target After=multi-user.target
[Service] [Service]
Type=simple Type=simple
ExecStart=/usr/bin/python3 /home/admin/${{ env.REPO_NAME }}/main.py ExecStart=/usr/bin/python3.10 /home/binlab/${{ env.REPO_NAME }}/main.py
User=root User=root
Restart=on-failure Restart=on-failure
RestartSec=30 RestartSec=30
WorkingDirectory=/home/admin/${{ env.REPO_NAME }}/ WorkingDirectory=/home/binlab/${{ env.REPO_NAME }}/
[Install] [Install]
WantedBy=multi-user.target" >> /etc/systemd/system/${{ env.REPO_NAME }}.service WantedBy=multi-user.target" >> /etc/systemd/system/${{ env.REPO_NAME }}.service
chmod +x /root/${{ env.REPO_NAME }}/main.py chmod +x /home/binlab/${{ env.REPO_NAME }}/main.py
sudo systemctl enable ${{ env.REPO_NAME }}.service sudo systemctl enable ${{ env.REPO_NAME }}.service
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl start ${{ env.REPO_NAME }}.service sudo systemctl start ${{ env.REPO_NAME }}.service
host: 172.17.0.1 host: 172.17.0.1
user: binlab user: binlab
key: ${{ secrets.SSH_PRIVATE_KEY }} key: ${{ secrets.KEY }}
create-systemctl-restart: create-systemctl-restart:
needs: [create-systemctl-service, add-bot-token, deploy-via-sftp] needs: [create-systemctl-service, add-bot-token, deploy-via-sftp]
@@ -98,6 +96,7 @@ jobs:
uses: https://github.com/fifsky/ssh-action@master uses: https://github.com/fifsky/ssh-action@master
with: with:
command: | command: |
sudo touch /etc/systemd/system/${{ env.REPO_NAME }}-watcher.service && chmod 666 /etc/systemd/system/${{ env.REPO_NAME }}-watcher.service
echo "[Unit] echo "[Unit]
Description=${{ env.REPO_NAME }} Discord Bot restart Description=${{ env.REPO_NAME }} Discord Bot restart
After=multi-user.target After=multi-user.target
@@ -111,4 +110,4 @@ jobs:
sudo systemctl start ${{ env.REPO_NAME }}-watcher.service sudo systemctl start ${{ env.REPO_NAME }}-watcher.service
host: 172.17.0.1 host: 172.17.0.1
user: binlab user: binlab
key: ${{ secrets.SSH_PRIVATE_KEY }} key: ${{ secrets.KEY }}