|
| 1 | +name: Create Release and Upload Artifact |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*.*.*' # Trigger this workflow only when a new tag is pushed |
| 7 | + |
| 8 | +jobs: |
| 9 | + build_and_release: |
| 10 | + runs-on: windows-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout code |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Setup MSBuild |
| 17 | + uses: microsoft/setup-msbuild@v2 |
| 18 | + with: |
| 19 | + msbuild-architecture: x64 |
| 20 | + |
| 21 | + - name: Setup NuGet |
| 22 | + uses: NuGet/setup-nuget@v2 |
| 23 | + |
| 24 | + - name: Restore NuGet packages |
| 25 | + run: nuget restore Examples/Infragistics.Samples.WPF.sln |
| 26 | + |
| 27 | + - name: Build the solution with forced output directory |
| 28 | + run: | |
| 29 | + $outputDir = "$env:GITHUB_WORKSPACE\build_output" |
| 30 | + Write-Host "Building to specific directory: $outputDir" |
| 31 | + msbuild Examples/Infragistics.Samples.WPF.sln /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=$outputDir\ |
| 32 | +
|
| 33 | + - name: Zip the build output |
| 34 | + run: | |
| 35 | + $outputPath = "$env:GITHUB_WORKSPACE\build_output" |
| 36 | + Compress-Archive -Path "$outputPath\*" -DestinationPath "wpf-app-release.zip" -Force |
| 37 | + Write-Host "Zipping complete." |
| 38 | +
|
| 39 | + - name: Create Release |
| 40 | + id: create_release |
| 41 | + uses: actions/create-release@v1 |
| 42 | + env: |
| 43 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 44 | + with: |
| 45 | + tag_name: ${{ github.ref }} |
| 46 | + release_name: Release ${{ github.ref }} |
| 47 | + draft: false |
| 48 | + prerelease: false |
| 49 | + |
| 50 | + - name: Upload Release Asset |
| 51 | + uses: actions/upload-release-asset@v1 |
| 52 | + env: |
| 53 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + with: |
| 55 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 56 | + asset_path: ./wpf-app-release.zip |
| 57 | + asset_name: wpf-app-release.zip |
| 58 | + asset_content_type: application/zip |
0 commit comments