This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
Merge pull request #4 from Jenway/dev #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) SduNetCheckTool | |
# Copyright (c) Microsoft Corporation. | |
# Licensed under the MIT license. | |
name: Build and Pack | |
on: | |
push: | |
branches: | |
- master | |
workflow_call: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
targetplatform: [x64] | |
Configuration: [Release] | |
runs-on: windows-latest | |
env: | |
# artifacts 命名 [名字]-[build-number]-[commit-hash] | |
artifactName: SduNetCheckTool-build.${{github.run_number}}-${{ github.sha }} | |
appPackagesArchive: SduNetCheckTool-build.${{github.run_number}}-${{ github.sha }}.zip | |
appPackagesExecutable: SduNetCheckTool-build.${{github.run_number}}-${{ github.sha }}.exe | |
solutionPath: SduNetCheckTool.sln | |
coreProjectDirectory: SduNetCheckTool.Core | |
guiProjectDirectory: SduNetCheckTool.GUI | |
coreProjectPath: SduNetCheckTool.Core\SduNetCheckTool.Core.csproj | |
guiProjectPath: SduNetCheckTool.GUI\SduNetCheckTool.GUI.csproj | |
Platform: x64 | |
Configuration: Release | |
RuntimeIdentifier: win-x64 | |
# appPackagesDirectory: bin\x64\Release | |
appPackagesDirectory: bin\$env:Platform\$env:Configuration | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Setup MSBuild.exe | |
uses: microsoft/setup-msbuild@v2 | |
- name: Restore and build the Wpf application | |
run: ./.github/utils/build.ps1 -SolutionPath ${{ env.solutionPath }} -Configuration ${{ env.Configuration }} -Platform ${{ env.Platform }} -RuntimeIdentifier ${{ env.RuntimeIdentifier }} | |
- name: Create archive | |
run: | | |
mkdir build | |
Compress-Archive -Path ${{ env.guiProjectDirectory }}\${{ env.appPackagesDirectory }}\* -DestinationPath build\${{ env.appPackagesArchive }} | |
- name: Pack into single file executable | |
run: | | |
Set-Location .\.github\utils\ | |
npm install . | |
Set-Location - | |
node .\.github\utils\pack.js | |
Move-Item build\SduNetCheckTool.GUI_boxed.exe build\${{ env.appPackagesExecutable }} | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.artifactName }} | |
path: | | |
build/${{ env.appPackagesArchive }} | |
build/${{ env.appPackagesExecutable }} | |
retention-days: 15 |