deploy zhihuiyun #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: deploy zhihuiyun | |
on: | |
workflow_dispatch: | |
inputs: | |
admin_github_token: | |
description: '管理员密钥' | |
required: true | |
type: string | |
env: | |
ADMIN_GITHUB_TOKEN: ${{ inputs.admin_github_token }} | |
jobs: | |
download: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- name: Set timezone to Asia/Shanghai | |
run: | | |
sudo timedatectl set-timezone Asia/Shanghai | |
date | |
- name: Checkout ollama-yun | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ env.ADMIN_GITHUB_TOKEN }} | |
repository: "isxcode/ollama-yun" | |
ref: 'main' | |
- name: Download zhihuiyun | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
script_stop: true | |
timeout: 1800s | |
script: | | |
rm -rf /tmp/zhihuiyun.tar.gz | |
curl -ssL https://isxcode.oss-cn-shanghai.aliyuncs.com/zhihuiyun/zhihuiyun.tar.gz -o /tmp/zhihuiyun.tar.gz | |
deploy: | |
needs: download | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- name: Set timezone to Asia/Shanghai | |
run: | | |
sudo timedatectl set-timezone Asia/Shanghai | |
date | |
- name: Deploy zhihuiyun | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
script_stop: true | |
timeout: 1800s | |
script: | | |
tar -vzxf /tmp/zhihuiyun.tar.gz -C /opt/ | |
rm -rf /tmp/zhiliuyun.tar.gz | |
bash /opt/zhihuiyun/bin/stop.sh | |
rm -rf /opt/zhihuiyun/conf/application-local.yml | |
cp /root/application-local.yml /opt/zhihuiyun/conf/application-local.yml | |
cp -r /opt/zhihuiyun/resources /opt/zhihuiyun/resources_bak/resources_$(date +'%Y-%m-%d-%H-%M-%S')_bak | |
bash /opt/zhihuiyun/bin/start.sh --print-log=false | |
sleep 120 | |
until curl -s https://zhihuiyun-demo.isxcode.com/tools/open/health | grep "UP"; do | |
echo "Waiting for service to be available..." | |
sleep 1 | |
done |