Skip to content

chore:Optimize youtube-music downloads #49

chore:Optimize youtube-music downloads

chore:Optimize youtube-music downloads #49

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- master # 仅在推送到主分支时触发
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Initialize Go modules
run: go mod tidy
- name: Build the project
run: go build -o chatbot
- name: Securely copy the binary to the server
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
REMOTE_PATH: /root/tgbot/chatbot
run: |
echo "${SSH_PRIVATE_KEY}" > private_key
chmod 600 private_key
scp -i private_key -o StrictHostKeyChecking=no chatbot ${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_PATH}
- name: Restart the service on the server
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
run: |
ssh -i private_key -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} "systemctl restart tgbot"