优化 GitHub 发布工作流,增加文件存在性检查并支持将发布标记为草稿。

This commit is contained in:
wood chen 2025-03-21 20:30:41 +08:00
parent e7ba7643ce
commit d955668598

View File

@ -73,12 +73,19 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ steps.version.outputs.tag }}" \
--title="${{ steps.version.outputs.tag }}" \
--notes "Release ${{ steps.version.outputs.tag }}" \
${{ env.PLUGIN_NAME }}-${{ steps.version.outputs.version }}.zip \
main.js \
manifest.json \
$([ -f "styles.css" ] && echo "styles.css") \
source-code.zip \
source-code.tar.gz
tag="${GITHUB_REF#refs/tags/}"
files=()
for file in main.js manifest.json; do
if [ -f "$file" ]; then
files+=("$file")
else
echo "Warning: $file not found"
exit 1
fi
done
gh release create "$tag" \
--title="$tag" \
--draft \
"${files[@]}"