Files
Sensitive-lexicon/.github/workflows/main.yml
2025-07-29 00:16:57 +08:00

48 lines
1.4 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: 自动发布 Sensitive-lexicon 压缩包
on:
push:
tags:
- '*' # 匹配所有 tag例如 1.0、2.3.4
workflow_dispatch:
inputs:
tag_name:
description: 'Tag 名称(如 1.0'
required: true
default: '1.0'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: 拉取仓库代码
uses: actions/checkout@v3
- name: 设置 Tag 和压缩文件名
id: release_info
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TAG_NAME="${{ github.event.inputs.tag_name }}"
else
TAG_NAME="${GITHUB_REF##*/}"
fi
FILE_NAME="Sensitive-lexicon-${TAG_NAME}.zip"
echo "tag_name=${TAG_NAME}" >> $GITHUB_OUTPUT
echo "file_name=${FILE_NAME}" >> $GITHUB_OUTPUT
- name: 压缩整个项目
run: |
zip -r ${{ steps.release_info.outputs.file_name }} . -x '*.git*'
- name: 上传到 GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.release_info.outputs.tag_name }} # 确保指定 tag
name: "Sensitive-lexicon ${{ steps.release_info.outputs.tag_name }}"
files: ${{ steps.release_info.outputs.file_name }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}