Files
xgj/release-web/action.yml

70 lines
1.9 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: 'Web项目发布构建'
description: '自动化Web项目发布流程支持版本管理和发布'
author: 'Your Organization'
branding:
icon: 'tag'
color: 'green'
inputs:
release-command:
description: '发布命令,例如 npm run release -- --release -V'
required: false
default: 'npm run release -- --release -V'
node-debug:
description: '是否启用Node.js调试模式 (true/false)'
required: false
default: 'false'
outputs:
version:
description: '发布的版本号'
value: ${{ steps.get_var.outputs.version }}
version-with-dash:
description: '版本号(点号替换为横线)'
value: ${{ steps.get_var.outputs.version_with_dash }}
runs:
using: 'composite'
steps:
- name: 发布构建
shell: bash
run: |
echo "🚀 开始发布构建..."
echo "执行命令: ${{ inputs.release-command }}"
${{ inputs.release-command }}
echo "✅ 发布构建完成"
env:
NODE_DEBUG: ${{ inputs.node-debug == 'true' && 'release-it:*' || '' }}
- name: 获取版本信息
id: get_var
shell: bash
run: |
echo "📝 获取版本信息..."
if [[ ! -f "/tmp/last-version" ]]; then
echo "❌ 错误: 版本文件 /tmp/last-version 不存在"
echo "请确保发布命令正确执行并生成了版本文件"
exit 1
fi
VERSION=$(cat /tmp/last-version)
VERSION_WITH_DASH=$(echo "$VERSION" | sed 's/\./-/g')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "version_with_dash=$VERSION_WITH_DASH" >> $GITHUB_OUTPUT
echo "📦 发布版本: $VERSION"
echo "📦 带横线版本: $VERSION_WITH_DASH"
- name: 发布总结
shell: bash
run: |
echo "🎉 发布流程完成!"
echo ""
echo "📋 发布信息:"
echo " - 版本号: ${{ steps.get_var.outputs.version }}"