-
-
Notifications
You must be signed in to change notification settings - Fork 3
wo4rkflow add file #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7e30119
85dc141
ed35049
de39af8
561be6d
e57b74f
2ff4516
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,67 @@ | ||||||||||
| name: .NET Core Desktop CI/CD | ||||||||||
|
|
||||||||||
| on: | ||||||||||
| push: | ||||||||||
| branches: [ "main" ] | ||||||||||
|
|
||||||||||
| jobs: | ||||||||||
| build: | ||||||||||
| strategy: | ||||||||||
| matrix: | ||||||||||
| configuration: [Debug, Release] | ||||||||||
|
|
||||||||||
| runs-on: windows-latest | ||||||||||
|
|
||||||||||
| env: | ||||||||||
| Solution_Name: MyApp.sln | ||||||||||
| Test_Project_Path: MyApp.Tests/MyApp.Tests.csproj | ||||||||||
| Wap_Project_Directory: MyApp.Package | ||||||||||
| Wap_Project_Path: MyApp.Package/MyApp.Package.wapproj | ||||||||||
|
|
||||||||||
| steps: | ||||||||||
| - name: Checkout source | ||||||||||
| uses: actions/checkout@v4 | ||||||||||
| with: | ||||||||||
| fetch-depth: 0 | ||||||||||
|
|
||||||||||
| - name: Install .NET 8 SDK | ||||||||||
| uses: actions/setup-dotnet@v4 | ||||||||||
| with: | ||||||||||
| dotnet-version: 8.0.x | ||||||||||
|
|
||||||||||
| - name: Setup MSBuild | ||||||||||
| uses: microsoft/setup-msbuild@v2 | ||||||||||
|
|
||||||||||
| - name: Run unit tests | ||||||||||
| run: dotnet test $env:Test_Project_Path | ||||||||||
|
|
||||||||||
| - name: Restore solution | ||||||||||
| run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration | ||||||||||
| env: | ||||||||||
| Configuration: ${{ matrix.configuration }} | ||||||||||
|
|
||||||||||
| - name: Decode signing certificate | ||||||||||
| run: | | ||||||||||
| $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}") | ||||||||||
| $certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx | ||||||||||
| [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) | ||||||||||
|
|
||||||||||
| - name: Build and package MSIX | ||||||||||
| env: | ||||||||||
| PFX_PASSWORD: ${{ secrets.Pfx_Key }} | ||||||||||
| run: msbuild $env:Wap_Project_Path /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:PackageCertificatePassword="$env:PFX_PASSWORD" | ||||||||||
| env: | ||||||||||
| Appx_Bundle: Always | ||||||||||
| Appx_Bundle_Platforms: x86|x64 | ||||||||||
| Appx_Package_Build_Mode: StoreUpload | ||||||||||
| Configuration: ${{ matrix.configuration }} | ||||||||||
|
|
||||||||||
| - name: Remove temporary certificate | ||||||||||
mulfapoeding-gif marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
| if: always() | ||||||||||
| run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx | ||||||||||
|
||||||||||
| run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx | |
| run: | | |
| $certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx | |
| Remove-Item -Path $certificatePath |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The artifact upload path uses backslash separators and may not work correctly if the directory structure changes. Consider using forward slashes or the format '${{ env.Wap_Project_Directory }}/bin/${{ matrix.configuration }}' for better cross-platform compatibility and consistency with GitHub Actions conventions.
| path: ${{ env.Wap_Project_Directory }}\bin\${{ matrix.configuration }} | |
| path: ${{ env.Wap_Project_Directory }}/bin/${{ matrix.configuration }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The certificate file is created but there's no error handling if the Base64_Encoded_Pfx secret is missing or invalid. If the secret is not set, this step will fail silently or create an invalid certificate file, leading to confusing build failures in subsequent steps. Consider adding validation or using the 'if' conditional to check if secrets are available.