Skip to content

fix

fix #25

name: 构建程序
on:
push:
branches:
- '**'
pull_request:
jobs:
Build:
runs-on: ubuntu-latest
strategy:
matrix:
runtimeIdentifier: [ win-x64, linux-x64]
name: 构建 MiniServer
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: 初始化.NET 8
uses: actions/setup-dotnet@v4
env:
DOTNET_CLI_UI_LANGUAGE: zh-CN
with:
dotnet-version: 8.0.x
- name: 编译
run: |
dotnet publish MiniServer/MiniServer.csproj --no-self-contained -p:PublishSingleFile=true -p:RuntimeIdentifier=${{ matrix.runtimeIdentifier }} --framework net8.0
- name: 上传临时文件
uses: actions/upload-artifact@v4
with:
name: MiniServer_${{ matrix.runtimeIdentifier }}_8.0
path: MiniServer/bin/Release/net8.0/${{ matrix.runtimeIdentifier }}/publish/
LatestRelease:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
name: 发布
runs-on: ubuntu-latest
needs: Build
permissions:
contents: write
actions: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 更新发布标签
run: |
git tag -f V1.0.0.0
git push -f origin V1.0.0.0
- name: 下载临时文件
uses: dawidd6/action-download-artifact@v9
with:
path: bin
run_id: ${{ github.run_id }}
skip_unpack: true
- name: 发布Release
uses: ncipollo/release-action@v1
with:
tag: V1.0.0.0
name: "最新版本"
body: ""
artifacts: |
./bin/*
allowUpdates: true
removeArtifacts: true
ClearTempArtifacts:
name: 清理临时文件
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && always()
runs-on: ubuntu-latest
needs:
- LatestRelease
permissions:
actions: write
steps:
- uses: geekyeggo/delete-artifact@v5
with:
name: |
MiniServer_*