diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bdf41cf..0503a7b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,6 +23,8 @@ defaults: shell: pwsh jobs: + + # Create the NuGet package create_nuget: runs-on: ubuntu-latest steps: @@ -52,11 +54,26 @@ jobs: if-no-files-found: error retention-days: 7 path: ${{ env.NuGetDirectory }}/*.nupkg + + # Run tests + run_test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + # Install .NET 9.0 SDK + - name: Setup .NET 9.0 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '9.0.x' # Use a specific version or '9.0.x' for the latest 9.0 preview + + - name: Run Tests + run: dotnet test --configuration Release - + # Validate the NuGet package validate_nuget: runs-on: ubuntu-latest - needs: [ create_nuget ] + needs: [ create_nuget, run_test ] steps: # Install .NET 9.0 SDK @@ -82,29 +99,28 @@ jobs: run: meziantou.validate-nuget-package (Get-ChildItem "${{ env.NuGetDirectory }}/*.nupkg") continue-on-error: true # Continue on Error - - run_test: + # Inform Discord that new PR is available and needs approval for PROD + notify_discord: + if: github.event_name == 'Release' runs-on: ubuntu-latest + needs: [ validate_nuget ] steps: - - uses: actions/checkout@v3 - - # Install .NET 9.0 SDK - - name: Setup .NET 9.0 - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.0.x' # Use a specific version or '9.0.x' for the latest 9.0 preview - - - name: Run Tests - run: dotnet test --configuration Release - + - name: Notify Discord + uses: rjstone/discord-webhook-notify@v1.0.4 + with: + severity: info + details: A new pull request is awaiting approval to initiate the creation of a NuGet package for FeatureMasterX. + webhookurl: ${{ secrets.DISCORD_WEBHOOK }} + + # Deploy to NuGet.org deploy: # Publish only when creating a GitHub Release # https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository # You can update this logic if you want to manage releases differently - if: github.event_name == 'release' + if: github.event_name == 'Release' runs-on: ubuntu-latest - needs: [ validate_nuget, run_test ] + needs: [ validate_nuget ] environment: name: Production # Your environment name url: ${{ steps.set-url.outputs.url }} # optional