Skip to content

extent workflow

extent workflow #48

name: .NET Core Desktop
on:
push:
branches:
- '*'
pull_request:
branches:
- master
- develop
jobs:
build:
strategy:
matrix:
configuration: [Release]
runs-on: windows-latest
env:
Solution_Name: Kreditrechner.sln
Wap_Project_Directory: Kreditrechner
Wap_Project_Path: Kreditrechner/Kreditrechner.csproj
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Setup MSBuild.exe
uses: microsoft/[email protected]
- name: Restore the application
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}
- name: Extract assembly version
id: extract-version
run: |
$versionLine = Get-Content -Path ./Kreditrechner/Properties/AssemblyInfo.cs | Select-String -Pattern '^\[assembly: AssemblyVersion'
$version = $versionLine -replace '.*\("(.*)\..*"\).*', '$1'
$formatted_version = "V-$version"
echo "Extracted Version: $formatted_version"
echo "##[set-output name=VERSION]$formatted_version"
- name: Create the app package
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=${{ secrets.Pfx_Key }}
env:
Appx_Bundle: Always
Appx_Bundle_Platforms: Any CPU
Appx_Package_Build_Mode: StoreUpload
Configuration: ${{ matrix.configuration }}
- name: Zip artifacts
run: |
$directoryToZip = "./Kreditrechner/bin"
$zipFileName = "LoanCalculator.zip"
Compress-Archive -Path $directoryToZip -DestinationPath $zipFileName
- name: Set Tag and make release
if: github.ref == 'refs/heads/master'
run: |
echo "${{ steps.extract-version.outputs.VERSION }}"
git tag ${{ steps.extract-version.outputs.VERSION }}
git push origin ${{ steps.extract-version.outputs.VERSION }}
gh release create ${{ steps.extract-version.outputs.VERSION }} ./LoanCalculator.zip --title "LoanCalculator_${{ steps.extract-version.outputs.VERSION }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: LoanCalculator
path: LoanCalculator.zip