Material Icons Release Pipeline #7
This file contains hidden or 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
| name: Material Icons Release Pipeline | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| TargetBranch: | |
| description: 'Target branch to build' | |
| type: string | |
| default: 'main' | |
| BuildConfiguration: | |
| description: 'Build configuration' | |
| type: string | |
| default: 'Release' | |
| PublishToNuget: | |
| description: 'Publish to nuget.org' | |
| type: boolean | |
| default: false | |
| env: | |
| SOURCE_DIR: ${{ github.workspace }} | |
| BASE_OUTPUT_DIR: ${{ github.workspace }}/output | |
| LOCAL_NUGET_DIR: ${{ github.workspace }}/nuget | |
| jobs: | |
| BuildAtomUINuget: | |
| name: Build Material Icons NuGet packages | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/[email protected] | |
| with: | |
| ref: ${{ inputs.TargetBranch }} | |
| - name: Setup .NET 10 | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Create local NuGet feed | |
| run: | | |
| $localFeedPath = $env:LOCAL_NUGET_DIR | |
| New-Item -Path $localFeedPath -ItemType Directory -Force | Out-Null | |
| Write-Output "Local NuGet feed created at: $localFeedPath" | |
| dotnet nuget add source $localFeedPath --name local-feed | |
| $sources = dotnet nuget list source | |
| if ($sources -match "local-feed") { | |
| Write-Output "Local feed added successfully" | |
| } else { | |
| Write-Error "Failed to add local feed" | |
| exit 1 | |
| } | |
| - name: Build AtomUI.Icons.Material projects | |
| shell: pwsh | |
| run: | | |
| # Build AtomUI.Icons.Material project | |
| dotnet build --configuration ${{ inputs.BuildConfiguration }} ./src/AtomUI.Icons.Material/AtomUI.Icons.Material.csproj | |
| - name: Create Material Icons NuGet packages | |
| shell: pwsh | |
| run: | | |
| $projects = @( | |
| "./src/AtomUI.Icons.Material/AtomUI.Icons.Material.csproj" | |
| ) | |
| foreach ($project in $projects) { | |
| dotnet pack --no-build --output $env:BASE_OUTPUT_DIR --configuration ${{ inputs.BuildConfiguration }} $project | |
| } | |
| $packages = Get-ChildItem -Path $env:BASE_OUTPUT_DIR -Filter *.nupkg -Recurse -File | |
| foreach ($pkg in $packages) { | |
| try { | |
| dotnet nuget push $pkg.FullName --source $env:LOCAL_NUGET_DIR | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Warning "pushed nuget package: $($pkg.Name)" | |
| } | |
| } | |
| catch { | |
| Write-Error "push $($pkg.Name) error: $_" | |
| } | |
| } | |
| - name: Upload NuGet artifacts | |
| uses: actions/[email protected] | |
| with: | |
| name: NuGetPackages | |
| path: ${{ env.BASE_OUTPUT_DIR }}/*.nupkg | |
| - name: Publish to nuget.org | |
| if: ${{ inputs.PublishToNuget == true }} | |
| shell: pwsh | |
| run: | | |
| $packages = Get-ChildItem -Path $env:BASE_OUTPUT_DIR -Filter *.nupkg -Recurse -File | |
| foreach ($pkg in $packages) { | |
| try { | |
| dotnet nuget push $pkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Warning "pushed nuget package: $($pkg.Name)" | |
| } | |
| } | |
| catch { | |
| Write-Error "push $($pkg.Name) error: $_" | |
| } | |
| } |