ci(updateR2): 新增发布类型选择并更新作业触发条件
新增工作流输入参数release_type,支持选择客户端、服务端或同时构建两者;将原有的基于分支名的作业条件判断改为基于该输入参数进行筛选。
This commit is contained in:
@@ -7,6 +7,15 @@ on:
|
||||
description: '要运行的分支'
|
||||
required: true
|
||||
default: 'main'
|
||||
release_type:
|
||||
description: '发布类型'
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- client
|
||||
- server
|
||||
- both
|
||||
default: 'both'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
@@ -31,7 +40,7 @@ jobs:
|
||||
|
||||
# 创建发布
|
||||
- name: Create Release
|
||||
if: github.ref_name == 'client'
|
||||
if: github.event.inputs.release_type == 'client' || github.event.inputs.release_type == 'both'
|
||||
uses: https://gitea.com/actions/gitea-release-action@v1
|
||||
with:
|
||||
tag_name: ${{ env.VERSION }}
|
||||
@@ -42,7 +51,7 @@ jobs:
|
||||
|
||||
# 初始化并配置 Rclone
|
||||
- name: Setup Rclone
|
||||
if: github.ref_name == 'client'
|
||||
if: github.event.inputs.release_type == 'client' || github.event.inputs.release_type == 'both'
|
||||
run: |
|
||||
curl https://rclone.org/install.sh | sudo bash
|
||||
mkdir -p ~/.config/rclone
|
||||
@@ -50,20 +59,20 @@ jobs:
|
||||
|
||||
# # 上传 modpack 档案
|
||||
- name: Upload Modpack
|
||||
if: github.ref_name == 'client'
|
||||
if: github.event.inputs.release_type == 'client' || github.event.inputs.release_type == 'both'
|
||||
run: |
|
||||
rclone copyto dist/client/mcmtrdy-modpack.zip mcmtrdy:mcmtrdy/mcmtrdy.zip
|
||||
rclone sync ./dist/client/modpack mcmtrdy:mcmtrdy/modpack
|
||||
|
||||
# 清除配置
|
||||
- name: Clear config
|
||||
if: github.ref_name == 'client'
|
||||
if: github.event.inputs.release_type == 'client' || github.event.inputs.release_type == 'both'
|
||||
run: |
|
||||
rm -rf ~/.config/rclone/rclone.conf
|
||||
|
||||
# 创建服务器mod
|
||||
- name: Create Server Mod
|
||||
if: github.ref_name == 'server'
|
||||
if: github.event.inputs.release_type == 'server' || github.event.inputs.release_type == 'both'
|
||||
run: |
|
||||
mkdir -p dist/server
|
||||
|
||||
@@ -96,6 +105,7 @@ jobs:
|
||||
|
||||
# 同步 mods 到远程服务器
|
||||
- name: Sync Server Mods
|
||||
if: github.event.inputs.release_type == 'server' || github.event.inputs.release_type == 'both'
|
||||
run: |
|
||||
sudo apt update -y
|
||||
sudo apt install -y sshpass rsync
|
||||
@@ -109,7 +119,7 @@ jobs:
|
||||
|
||||
# 安装 mcrcon 并发送 RCON 指令
|
||||
- name: RCON Broadcast
|
||||
if: github.ref_name == 'server'
|
||||
if: github.event.inputs.release_type == 'server' || github.event.inputs.release_type == 'both'
|
||||
run: |
|
||||
# 安装 mcrcon
|
||||
sudo apt update -y
|
||||
|
||||
Reference in New Issue
Block a user