mirror of
https://github.com/tgbot-collection/YYeTsBot.git
synced 2025-11-25 11:29:38 +08:00
cd using github actions
This commit is contained in:
10
.github/workflows/builder.yaml
vendored
10
.github/workflows/builder.yaml
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
name: build docker image
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -62,4 +63,11 @@ jobs:
|
|||||||
- name: Move cache
|
- name: Move cache
|
||||||
run: |
|
run: |
|
||||||
rm -rf /tmp/.buildx-cache
|
rm -rf /tmp/.buildx-cache
|
||||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||||
|
|
||||||
|
- name: Notification to Telegram
|
||||||
|
env:
|
||||||
|
TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||||
|
run: |
|
||||||
|
curl "https://api.telegram.org/bot$TOKEN/sendMessage?chat_id=260260121&text=Normal%20Build%20complete!"
|
||||||
|
echo "Build complete!"
|
||||||
|
|||||||
26
.github/workflows/normal_upgrade.yaml
vendored
Normal file
26
.github/workflows/normal_upgrade.yaml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: Normal upgrade
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: executing remote ssh commands using ssh key
|
||||||
|
uses: appleboy/ssh-action@master
|
||||||
|
env:
|
||||||
|
TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||||
|
with:
|
||||||
|
envs: TOKEN
|
||||||
|
host: ${{ secrets.PROD_HOST }}
|
||||||
|
username: ${{ secrets.PROD_USERNAME }}
|
||||||
|
key: ${{ secrets.SSH_KEY }}
|
||||||
|
script: |
|
||||||
|
docker save bennythink/yyetsbot > /root/yyetsbot-old.tar
|
||||||
|
docker pull bennythink/yyetsbot
|
||||||
|
docker-compose -f /home/WebsiteRunner/docker-compose.yml up -d
|
||||||
|
docker-compose -f /home/BotsRunner/docker-compose.yml up -d
|
||||||
|
curl "https://api.telegram.org/bot$TOKEN/sendMessage?chat_id=260260121&text=Normal%20upgrade%20complete!"
|
||||||
|
echo "Normal upgrade complete!"
|
||||||
18
.github/workflows/prod.yaml
vendored
18
.github/workflows/prod.yaml
vendored
@@ -1,18 +0,0 @@
|
|||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- 'master'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: executing remote ssh commands using ssh key
|
|
||||||
uses: appleboy/ssh-action@master
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.PROD_HOST }}
|
|
||||||
username: ${{ secrets.PROD_USERNAME }}
|
|
||||||
key: ${{ secrets.SSH_KEY }}
|
|
||||||
script: |
|
|
||||||
hostname
|
|
||||||
w
|
|
||||||
36
.github/workflows/rapid_upgrade.yaml
vendored
Normal file
36
.github/workflows/rapid_upgrade.yaml
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
name: Rapid upgrade
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: emergency update from ssh
|
||||||
|
if: github.event.issue.labels[0].name == 'upgrade'
|
||||||
|
uses: appleboy/ssh-action@master
|
||||||
|
env:
|
||||||
|
TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||||
|
with:
|
||||||
|
envs: TOKEN
|
||||||
|
host: ${{ secrets.PROD_HOST }}
|
||||||
|
username: ${{ secrets.PROD_USERNAME }}
|
||||||
|
key: ${{ secrets.SSH_KEY }}
|
||||||
|
command_timeout: 30m
|
||||||
|
script: |
|
||||||
|
docker save bennythink/yyetsbot > /root/yyetsbot-old.tar
|
||||||
|
cd /root/YYeTsBot
|
||||||
|
make prod
|
||||||
|
docker-compose -f /home/WebsiteRunner/docker-compose.yml up -d
|
||||||
|
docker-compose -f /home/BotsRunner/docker-compose.yml up -d
|
||||||
|
curl "https://api.telegram.org/bot$TOKEN/sendMessage?chat_id=260260121&text=Rapid%20upgrade%20complete!"
|
||||||
|
echo "Rapid upgrade complete!"
|
||||||
|
|
||||||
|
- name: Close Issue
|
||||||
|
if: github.event.issue.labels[0].name == 'upgrade'
|
||||||
|
uses: peter-evans/close-issue@v1
|
||||||
|
with:
|
||||||
|
comment: Upgrade complete. Close this issue.
|
||||||
8
Makefile
8
Makefile
@@ -30,13 +30,11 @@ zip:
|
|||||||
|
|
||||||
docker:
|
docker:
|
||||||
# production configuration
|
# production configuration
|
||||||
rm -f YYeTsFE/.env
|
|
||||||
cp .env YYeTsFE/.env
|
cp .env YYeTsFE/.env
|
||||||
# docker buildx create --use --name mybuilder
|
# docker buildx create --use --name mybuilder
|
||||||
docker buildx build --platform=linux/amd64,linux/arm64 -t bennythink/yyetsbot . --push
|
docker buildx build --platform=linux/amd64,linux/arm64 -t bennythink/yyetsbot . --push
|
||||||
|
|
||||||
local:
|
prod:
|
||||||
make update
|
make update
|
||||||
docker build --build-arg env=dev \
|
cp .env YYeTsFE/.env
|
||||||
--build-arg http_proxy=http://192.168.7.67:23456 \
|
docker build -t bennythink/yyetsbot .
|
||||||
-t bennythink/yyetsbot .
|
|
||||||
|
|||||||
Reference in New Issue
Block a user