Now I find usefull that,every time that I push some code,the code is build and the nuget package is attached . So GitHub Actions to the rescue.
There will be 2 GitHub actions – one for build and package,other for deploying to the Azure a test application This is the code for building. ( The code for azure is automatically generated by Azure … so no need to put here)
name: .NET
on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Setup .NET
      uses: actions/setup-dotnet@v2
      with:
        dotnet-version: 6.0.x
    - name: Restore dependencies
      run: |
        cd src 
        cd UsefullEndpoints
        dotnet tool restore
        dotnet pwsh readme.ps1        
        dotnet restore
    - name: Build
      run: |
        cd src
        cd UsefullEndpoints
        
        dotnet build --no-restore
    - name: Pack
      run: |
        cd src
        cd UsefullEndpoints
        cd UsefullExtensions
        dotnet pack -o ../nugetPackages  --include-symbols --include-source
    - name: 'Upload nuget'
      #if: ${{ github.ref == 'refs/heads/main' }}
      uses: actions/upload-artifact@v2
      with:
        name: UsefullEndpoints_${{github.run_number}}
        path: src/UsefullEndpoints/nugetPackages
        retention-days: 1
You can see
- 
as Swagger at https://netcoreusefullendpoints.azurewebsites.net/swagger
 - 
As BlocklyAutomation at https://netcoreusefullendpoints.azurewebsites.net/BlocklyAutomation
 - 
As package at https://www.nuget.org/packages/NetCoreUsefullEndpoints
 
Leave a Reply