Update build scripts

This commit is contained in:
Connection Refused
2020-05-07 21:00:34 +08:00
parent 0b46f8d8af
commit 152f49c161
2 changed files with 36 additions and 45 deletions

View File

@@ -1,44 +1,44 @@
name: GitHub Actions & Netch CI
name: Netch CI
on: [push]
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Get tag name
uses: olegtarasov/get-tag@v1
steps:
- name: NuGet
uses: nuget/setup-nuget@v1
- name: submodules-init
uses: snickerbockers/submodules-init@v4
- uses: nuget/setup-nuget@v1
- run: nuget restore Netch.sln
- name: Setup MSBuild.exe
- name: MSBuild
uses: microsoft/setup-msbuild@v1.0.0
- name: Build .NET 4.8 Netch
- name: Checkout
uses: actions/checkout@v2
- name: Update submodules
uses: snickerbockers/submodules-init@v4
- name: Restore NuGet Package
run: nuget restore Netch.sln
- name: Build .NET 4.8
shell: pwsh
run: |
.\build.ps1
.\BUILD.ps1
New-Item -ItemType Directory -Path C:\builtfiles -Force > $null
Compress-Archive -Path Netch\bin\x64\Release\win-x64\* -DestinationPath C:\builtfiles\Netch-${{ env.GITHUB_TAG_NAME }}.zip
echo "::set-env name=Netch_SHA256::$(.\getSHA256.ps1 C:\builtfiles\Netch-${{ env.GITHUB_TAG_NAME }}.zip)"
echo "::set-env name=Netch_SHA256::$(.\GetSHA256.ps1 C:\builtfiles\Netch-${{ env.GITHUB_TAG_NAME }}.zip)"
- name: Upload Netch
- name: Upload
uses: actions/upload-artifact@v1
with:
name: Netch
path: Netch\bin\x64\Release\win-x64
# Create a new release: create a tag, then 'git push origin <tagname>', wait for it to build
- name: Create a new GitHub release if a new tag is pushed
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
if: startsWith(github.ref, 'refs/tags/')
with:
name: ${{ env.GITHUB_TAG_NAME }}
prerelease: true
@@ -50,12 +50,9 @@ jobs:
[![](https://img.shields.io/badge/Telegram-Channel-blue)](https://t.me/Netch) [![](https://img.shields.io/badge/Telegram-Group-green)](https://t.me/Netch_Discuss_Group)
## 更新日志:
* 这是 GitHub Action 自动化部署,更新日志应该很快会手动更新:D
* 这是 GitHub Action 自动化部署,更新日志应该很快会手动更新
## 文件校验
## 校验
| 文件名 | SHA256 |
| :- | :- |
| <sub>Netch-${{ env.GITHUB_TAG_NAME }}.zip</sub> | <sub>${{ env.Netch_SHA256 }}</sub> |
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
| Netch-${{ env.GITHUB_TAG_NAME }}.zip | ${{ env.Netch_SHA256 }} |

View File

@@ -1,4 +1,3 @@
# REM The reason we don't use dotnet build is that dotnet build doesn't support COM references yet https://github.com/microsoft/msbuild/issues/3986
param([string]$buildtfm = 'all')
Write-Host 'dotnet SDK version'
@@ -14,28 +13,23 @@ Write-Host $net_baseoutput
function Build-NetFrameworkx64
{
Write-Host 'Building .NET Framework x64'
$outdir = "$net_baseoutput\x64"
msbuild -v:m -m -t:Build /p:Configuration="Release" /p:Platform="x64" /p:TargetFramework=net48 /p:Runtimeidentifier=win-x64 /restore
if ($LASTEXITCODE) { cd $mainDir ; exit $LASTEXITCODE }
Write-Host 'Build x64 Complete ,Started Copy bin,mode,i18n file'
Copy-Item "$mainDir\translations\i18n\*" "$net_baseoutput\x64\Release\win-x64\i18n" -recurse
Copy-Item "$mainDir\modes\mode\*" "$net_baseoutput\x64\Release\win-x64\mode" -recurse
Remove-Item -path "$net_baseoutput\x64\Release\win-x64\bin\tap-driver"
Copy-Item "$mainDir\binaries\*" -destination "$net_baseoutput\x64\Release\win-x64\bin" -recurse
Write-Host 'Netch Build ALL DONE'
Write-Host 'Build x64 Completed, start copy bin, mode, i18n file'
Copy-Item -Recurse "$mainDir\binaries\*" -destination "$net_baseoutput\x64\Release\win-x64\bin"
Copy-Item -Recurse "$mainDir\modes\mode\*" "$net_baseoutput\x64\Release\win-x64\mode"
Copy-Item -Recurse "$mainDir\translations\i18n\*" "$net_baseoutput\x64\Release\win-x64\i18n"
Remove-Item -Path "$net_baseoutput\x64\Release\win-x64\bin\tap-driver"
Write-Host 'Build done'
}
cd $mainDir\Netch
Build-NetFrameworkx64
cd $mainDir
exit 0