-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (67 loc) · 2.42 KB
/
dotnet.yml
File metadata and controls
81 lines (67 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: .NET
on:
push:
branches: [ "master"]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 9.x
- name: Build
shell: bash
run: |
dotnet build OTAPIXmlDocument.sln -c Release
ota_content=$(cat OTAPI/OTAPI.xml)
powershell_script=$(cat <<EOL
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
\$OutputEncoding = [System.Text.Encoding]::UTF8
\$OTA = @"
$ota_content
"@
\$dllFiles = Get-ChildItem -Path "\$env:USERPROFILE/.nuget/packages/otapi.upcoming" -Recurse -Filter "OTAPI.dll"
if (\$dllFiles.Count -eq 0) {
Write-Host "未找到任何 OTAPI.dll 文件。"
} else {
foreach (\$dllFile in \$dllFiles) {
\$targetDir = \$dllFile.DirectoryName
\$xmlPath = Join-Path -Path \$targetDir -ChildPath "OTAPI.xml"
New-Item -Path \$xmlPath -ItemType "file" -Force | Out-Null
Set-Content -Path \$xmlPath -Value \$OTA -Encoding UTF8
Write-Host "已创建 OTAPI.xml 在: \$xmlPath"
}
}
Pause
EOL
)
echo "$powershell_script" > install.ps1
echo "PowerShell安装脚本已生成: install.ps1"
- name: Set Release Tag
id: set_tag
run: echo "::set-output name=tag::v$(date +'%Y.%m.%d')"
- name: Update Tag
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
git tag -f ${{ steps.set_tag.outputs.tag }}
git push -f origin ${{ steps.set_tag.outputs.tag }}
- name: Release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.set_tag.outputs.tag }}
name: OTAPIXmlDocument ${{ steps.set_tag.outputs.tag }}
body: |
# OTAPIXmlDocument Ciallo~(∠・ω< )⌒☆
### 📅 使用Powershell打开脚本即可安装
### 📖 默认路径为最新的OTAPI Nuget所在路径
### 📦 Auto Build By Github Action
artifacts: |
./OTAPI/OTAPI.xml
./install.ps1
allowUpdates: true
removeArtifacts: true