Skip to content

Update .gitignore

Update .gitignore #101

Workflow file for this run

name: Release Win/Linux Packages
on:
push:
branches: [main, master]
workflow_dispatch:
jobs:
build-packages:
runs-on: windows-latest
strategy:
matrix:
runtime: [win-x64, linux-x64]
steps:
- name: 检出代码
uses: actions/checkout@v4
- name: 安装 .NET 8 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
cache: false
- name: 还原依赖
run: dotnet restore ./src/GeneralUpdate.Tool.Avalonia.sln
- name: 发布应用
run: dotnet publish ./src/GeneralUpdate.Tool.Avalonia.sln `
-c Release `
-r ${{ matrix.runtime }} `
-o ./publish/${{ matrix.runtime }} `
--self-contained true `
/p:PublishSingleFile=true `
/p:DebugType=None
- name: 打包压缩包
run: |
$date = Get-Date -Format "yyyyMMdd"
$zipName = "GeneralUpdate.Tool.Avalonia_${{ matrix.runtime }}_$date.zip"
Compress-Archive -Path ./publish/${{ matrix.runtime }}/* -DestinationPath $zipName -Force
echo "zip_file=$zipName" >> $env:GITHUB_ENV
- name: 上传压缩包
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.runtime }}-package
path: ${{ env.zip_file }}
create-release:
needs: build-packages
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# 关键修复:先检出代码,获取.git目录
- name: 检出代码(用于Git Tag操作)
uses: actions/checkout@v4
with:
fetch-depth: 0 # 拉取完整历史,包含Tag信息
- name: 下载所有压缩包
uses: actions/download-artifact@v4
with:
path: ./packages
- name: 生成日期Tag并推送
id: gen-tag
run: |
TAG_NAME="v$(date +%Y%m%d)"
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git fetch --tags origin # 显式拉取远程Tag
if ! git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
git tag "$TAG_NAME"
git push origin "$TAG_NAME"
echo "✅ 创建Tag: $TAG_NAME"
else
echo "ℹ️ Tag $TAG_NAME 已存在"
fi
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
- name: 发布到Releases
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.gen-tag.outputs.tag_name }}
name: Release ${{ steps.gen-tag.outputs.tag_name }}
files: ./packages/**/*.zip
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}