Files
other-web/.gitea/workflows/main.yml
root c9422161f3
All checks were successful
Deploy to Server / deploy (push) Has been skipped
1
2024-12-01 00:12:46 +08:00

38 lines
1.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Deploy to Server
on:
push:
branches:
- main # 假设你的主分支是main如果不是请替换成你的主分支名称
# 你可以根据需要添加其他触发条件
jobs:
deploy:
runs-on: server
if: contains(github.event.head_commit.message, '发布') # 检查提交信息是否包含“发布”
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} # 你需要在Gitea仓库的Settings/Secrets中设置一个名为GITEA_TOKEN的Secret值为你的访问令牌
run: |
git config --global user.email "2024374354@qq.com" # 替换为你的邮箱
git config --global user.name "hexianglong" # 替换为你的名字
git tag -a v$(date +%Y%m%d%H%M%S) -m "Release $(date +%Y%m%d%H%M%S)" # 创建一个基于当前时间的标签
git push origin v$(date +%Y%m%d%H%M%S) # 推送标签到Gitea
- name: SSH and Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }} # 服务器IP地址
username: ${{ secrets.USERNAME }} # 服务器用户名
password: ${{ secrets.PASSWORD }} # 服务器密码你需要在Gitea仓库的Settings/Secrets中设置
port: 22 # 如果不是默认的22端口请替换成正确的端口号
script: |
cd /www
wget http://10.147.17.160:3000/he_and_smallyue/other-web/releases/latest/download -O release.zip # 替换成你的实际下载链接
unzip release.zip
rm release.zip