diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml index 070c2fa2..f6be6aa8 100644 --- a/.github/workflows/nuget.yml +++ b/.github/workflows/nuget.yml @@ -1,40 +1,28 @@ -# This is a basic workflow to help you get started with Actions - name: Nuget -# Controls when the workflow will run on: - # Triggers the workflow on push or pull request events but only for the "main" branch push: branches: [ "main", release-*, develop ] pull_request: branches: [ "main", release-*, develop ] - # Allows you to run this workflow manually from the Actions tab workflow_dispatch: -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" build: - # The type of runner that the job will run on runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v4 with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of commits + fetch-depth: 0 submodules: 'true' - # Install .NET Core SDK - name: Setup .NET Core uses: actions/setup-dotnet@v4 with: dotnet-version: 8.x - # Pack Nuget - name: Build and Pack Nugets run: dotnet pack src/FishyFlip.sln --configuration Release --output nupkg @@ -43,3 +31,34 @@ jobs: with: name: nupkg path: nupkg/*.nupkg + publish: + needs: [build] + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/develop' && github.event_name == 'push' + + steps: + - name: Download Nuget Package + uses: actions/download-artifact@v4 + with: + name: nupkg + path: nupkg + + - name: Wait for Tests + uses: lewagon/wait-on-check-action@v1.3.4 + with: + ref: ${{ github.ref }} + check-name: 'Tests' + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 10 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + + - name: Publish to NuGet + run: | + for f in ./nupkg/*.nupkg + do + dotnet nuget push $f --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate + done \ No newline at end of file