diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c5acf952d6..c92abb3eb4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,6 +8,13 @@ on: push: # only trigger on branches, not on tags branches: '**' + workflow_dispatch: + inputs: + UseLastRepositoryBuild: + description: 'Use latest NuGet packages from JNet' + required: true + default: false + type: boolean # This workflow contains two jobs called "check_changes", "build_windows" jobs: @@ -75,6 +82,26 @@ jobs: fetch-depth: '1' submodules: 'true' + - name: Get last workflow run of JNet + if: ${{ inputs.UseLastRepositoryBuild == true }} + shell: bash + run: echo "JNET_LAST_RUN=$(curl -sL https://api.github.com/repos/masesgroup/JNet/actions/workflows/build.yaml/runs | jq -r '.workflow_runs[0].id?')" >> $GITHUB_ENV + + - name: Download artifact + if: ${{ inputs.UseLastRepositoryBuild == true }} + run: gh run download ${{ env.JNET_LAST_RUN }} --name JNetNuGet --repo masesgroup/JNet --dir JNetNuGet + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: List NuGet packages downloaded + continue-on-error: true + shell: cmd + run: dir .\JNetNuGet\*nupkg + + - name: Add local repo + if: ${{ success() && inputs.UseLastRepositoryBuild == true }} + run: dotnet nuget add source --name local "${{ github.workspace }}\JNetNuGet\" + - name: Pre compile run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src\net\KNet\KNet.csproj env: @@ -123,7 +150,7 @@ jobs: Copy-Item .\src\net\KNetPS\MASES.KNetPS.psd1 -Destination .\MASES.KNetPS\MASES.KNetPS.psd1 -Force Copy-Item .\src\net\KNetPS\MASES.KNetPS.psm1 -Destination .\MASES.KNetPS\MASES.KNetPS.psm1 -Force shell: pwsh - + - name: Create PowerShell package run: | $env:DOTNET_CLI_UI_LANGUAGE="en_US" @@ -137,7 +164,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: KNet + name: KNetNuGet path: .\bin\*nupkg - name: Compile tests