releases #4
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: releases | |
| on: | |
| workflow_dispatch: | |
| env: | |
| DOTNET_NOLOGO: true # Disable the .NET logo | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Disable the .NET first time experience | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true # Disable sending .NET CLI telemetry | |
| DOTNET_VERSION: '10.0' | |
| CSPROJ_FILE_PATH: 'src/BlazorWebView/src/AspNetCore.Components.WebView.Gtk.csproj' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout the code | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| # Install .NET SDK | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: '${{ env.DOTNET_VERSION }}.x' | |
| # Get the commit count and format the version | |
| - name: Get commit count and format version | |
| id: version | |
| shell: bash | |
| run: | | |
| commit_count=$(git rev-list --count HEAD) | |
| major=$((commit_count / 100)) | |
| minor=$((commit_count % 100 / 10)) | |
| patch=$((commit_count % 10)) | |
| formatted_version="$major.$minor.$patch" | |
| echo "VERSION=$formatted_version" >> $GITHUB_ENV | |
| - name: Restore Dependencies | |
| run: dotnet restore ${{ env.CSPROJ_FILE_PATH }} | |
| - name: Build | |
| run: dotnet build ${{ env.CSPROJ_FILE_PATH }} --configuration Release --no-restore | |
| - name: Pack | |
| run: dotnet pack ${{ env.CSPROJ_FILE_PATH }} -p:PackageVersion=${{ env.VERSION }} -c:Release --no-build --output nupkgs | |
| - name: Push NuGet Package | |
| shell: bash | |
| run: dotnet nuget push nupkgs/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}} |